Advanced Node and Express - passing tests but don't see expected results

Hi there.

I am working my way through Advanced Node and Express (https://www.freecodecamp.org/learn/quality-assurance/#advanced-node-and-express) and have passed all the tests (done 20 lessons so far). However, although I am passing the tests I am not really seeing what the lessons say I should see.

For example, in lesson 18 (Communicate by Emitting) it says "Now, try loading up your app, authenticate, and you should see in your client console '1' representing the current user count! Try loading more clients up, and authenticating to see the number go up." I don’t see that in my console.

Lesson 20 (Authentication with Socket.IO) has me putting this code into my server.js

function onAuthorizeSuccess(data, accept) {
  console.log('successful connection to socket.io');

  accept(null, true);
}

function onAuthorizeFail(data, message, error, accept) {
  if (error) throw new Error(message);
  console.log('failed connection to socket.io:', message);
  accept(null, false);
}

When I run via https://boilerplate-advancednode.alanbra.repl.co and press Login I get a screen like so:

My console just shows:
image

If I run via https://boilerplate-advancednode.alanbra.repl.co and press Login via Github! I get a screen like so:
image
and my console looks like this:

 npm start

> fcc-advanced-node-and-express@0.0.1 start
> node server.js

Listening on port 3000
{
  id: '112013861',
  displayName: null,
  username: 'AlanBrad',
  profileUrl: 'https://github.com/AlanBrad',
  photos: [
    { value: 'https://avatars.githubusercontent.com/u/112013861?v=4' }
  ],
  provider: 'github',
  _raw: '{"login":"AlanBrad","id":112013861,"node_id":"U_kgDOBq0yJQ","avatar_url":"https://avatars.githubusercontent.com/u/112013861?v=4","gravatar_id":"","url":"https://api.github.com/users/AlanBrad","html_url":"https://github.com/AlanBrad","followers_url":"https://api.github.com/users/AlanBrad/followers","following_url":"https://api.github.com/users/AlanBrad/following{/other_user}","gists_url":"https://api.github.com/users/AlanBrad/gists{/gist_id}","starred_url":"https://api.github.com/users/AlanBrad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AlanBrad/subscriptions","organizations_url":"https://api.github.com/users/AlanBrad/orgs","repos_url":"https://api.github.com/users/AlanBrad/repos","events_url":"https://api.github.com/users/AlanBrad/events{/privacy}","received_events_url":"https://api.github.com/users/AlanBrad/received_events","type":"User","site_admin":false,"name":null,"company":null,"blog":"","location":null,"email":null,"hireable":null,"bio":null,"twitter_username":null,"public_repos":7,"public_gists":0,"followers":0,"following":0,"created_at":"2022-08-24T18:10:24Z","updated_at":"2022-10-14T22:26:40Z"}',
  _json: {
    login: 'AlanBrad',
    id: 112013861,
    node_id: 'U_kgDOBq0yJQ',
    avatar_url: 'https://avatars.githubusercontent.com/u/112013861?v=4',
    gravatar_id: '',
    url: 'https://api.github.com/users/AlanBrad',
    html_url: 'https://github.com/AlanBrad',
    followers_url: 'https://api.github.com/users/AlanBrad/followers',
    following_url: 'https://api.github.com/users/AlanBrad/following{/other_user}',
    gists_url: 'https://api.github.com/users/AlanBrad/gists{/gist_id}',
    starred_url: 'https://api.github.com/users/AlanBrad/starred{/owner}{/repo}',
    subscriptions_url: 'https://api.github.com/users/AlanBrad/subscriptions',
    organizations_url: 'https://api.github.com/users/AlanBrad/orgs',
    repos_url: 'https://api.github.com/users/AlanBrad/repos',
    events_url: 'https://api.github.com/users/AlanBrad/events{/privacy}',
    received_events_url: 'https://api.github.com/users/AlanBrad/received_events',
    type: 'User',
    site_admin: false,
    name: null,
    company: null,
    blog: '',
    location: null,
    email: null,
    hireable: null,
    bio: null,
    twitter_username: null,
    public_repos: 7,
    public_gists: 0,
    followers: 0,
    following: 0,
    created_at: '2022-08-24T18:10:24Z',
    updated_at: '2022-10-14T22:26:40Z'
  }
}

No mention made of any connection to socket.io (successful or otherwise).

I’m very confused and am sure I must be doing something wrong somewhere even though I’m passing the tests.

My replit code is at boilerplate-advancednode - Replit

The client console is the browser. Do you see it in the browser console?

The browser console > Ctrl + Shift + J

Thank you for replying. I tried that - here is the result - I’m afraid I don’t really understand any of it :frowning:

If I fork your code and use my own DB and OAuth App it works for me.

Try it in Chrome, it should log a number to the console when you log in with GitHub (for every time you do it it should increase the number)

Edit: In the Firefox console disable everything except the Logs (click the Errors, Warnings, Info, then click the Logs to only have that enabled).

It also seems like you have to use the “Multiprocess (Slower)” option.

Thanks for replying.

This is what I get in Chrome:

and this is what I get in Firefox:

I have solved the problem - I moved the chat route before the 404 one and moved the socket code in server.js into the database connection.

Thank you so much for taking the time to advise me - the tip about the browser console really helped