passport-forcedotcom icon indicating copy to clipboard operation
passport-forcedotcom copied to clipboard

The "url" argument must be of type string. Received undefined.

Open ShreyaNimma-at opened this issue 1 year ago • 7 comments

We noticed the following error occur in this library, specifically at this line of code. It's not clear to me under what circumstances rawProfile.urls.users is undefined but it's a fatal error. It is also hard to catch this error outside of this library because this line of code is within an asynchronous callback and handling errors within asynchronous callbacks is tricky in Node. It would be nice to handle this error in-place so that it doesn't terminate the calling process.

TypeError: The "url" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:387:5)
    at validateString (node:internal/validators:121:11)
    at Url.parse (node:url:168:3)
    at Object.urlParse [as parse] (node:url:155:13)
    at node_modules/.store/passport-forcedotcom-npm-0.1.5-6bd2f32086/node_modules/passport-forcedotcom/lib/passport-forcedotcom/strategy.js:100:24
    at node_modules/.store/passport-forcedotcom-npm-0.1.5-6bd2f32086/node_modules/passport-forcedotcom/lib/passport-forcedotcom/strategy.js:133:5
    at passBackControl (node_modules/.store/oauth-npm-0.9.15-a6aae972bc/node_modules/oauth/lib/oauth2.js:134:9)
    at IncomingMessage.<anonymous> (node_modules/.store/oauth-npm-0.9.15-a6aae972bc/node_modules/oauth/lib/oauth2.js:157:7)
    at IncomingMessage.emit (node:events:525:35)
    at IncomingMessage.emit (node:domain:552:15)
    at endReadableNT (node:internal/streams/readable:1358:12)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)

ShreyaNimma-at avatar Jul 18 '23 20:07 ShreyaNimma-at

Running into this error as well, and would like to echo the sentiment that this error is really hard to catch and trap outside of the library because of the way its used. Would it be possible to do something like simply skip the photo url if the rawProfile.urls.users is undefined? something like this. Would be happy to open a PR for this to solve uncaught error.

trwinquist avatar Dec 05 '23 16:12 trwinquist

@joshbirk let me know if the linked PR seems like an alright way to fix this!

trwinquist avatar Dec 05 '23 22:12 trwinquist

@joshbirk could you publish the new version to npm so we can bump the version that we're using?

trwinquist avatar Dec 11 '23 18:12 trwinquist

The same issue. @joshbirk please, publish the new version to the npm with mentioned fix. We would appreciate.

kukidon-dev avatar Dec 15 '23 10:12 kukidon-dev

version 0.2.1 has been published

trwinquist avatar Dec 20 '23 18:12 trwinquist

Thank you!

kukidon-dev avatar Dec 21 '23 10:12 kukidon-dev

Just want to add a small note here about when this seemed to happen. It appears that free/demo salesforce accounts do not have this parameter available on the user profile while paid accounts do

trwinquist avatar Jan 22 '24 21:01 trwinquist