mozilla / fxa-oauth-server

OAuth server for Firefox Accounts
49 stars 40 forks source link

`Cannot read property 'hasScopedKeys' of undefined #593

Closed shane-tomlinson closed 6 years ago

shane-tomlinson commented 6 years ago

I am playing around with scoped keys on a side project using stable. The call to /authorize fails with a 500, this is in the logs:

fxa-oauth-server.summary.ERROR: summary {"code":500,"errno":999,"method":"post","path":"/v1/authorization","agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:61.0) Gecko/20100101 Firefox/61.0","t":38,"client_id":"e56eec0f35e65a91","auth":null,"payload":["assertion","client_id","scope","state","access_type","response_type","ttl","redirect_uri"],"remoteAddressChain":["95.85.19.180","172.31.47.9","127.0.0.1"],"stack":"TypeError: Cannot read property 'hasScopedKeys' of undefined\n at db.getScope.then.s (/app/lib/routes/authorization.js:241:23)\n at bound (domain.js:301:14)\n at runBound (domain.js:314:12)\n at tryCatcher (/app/node_modules/bluebird/js/main/util.js:26:23)\n at Promise._settlePromiseFromHandler (/app/node_modules/bluebird/js/main/promise.js:510:31)\n at Promise._settlePromiseAt (/app/node_modules/bluebird/js/main/promise.js:584:18)\n at Promise._settlePromises (/app/node_modules/bluebird/js/main/promise.js:700:14)\n at Async._drainQueue (/app/node_modules/bluebird/js/main/async.js:123:16)\n at Async._drainQueues (/app/node_modules/bluebird/js/main/async.js:133:10)\n at Immediate.Async.drainQueues (/app/node_modules/bluebird/js/main/async.js:15:14)\n at runCallback (timers.js:810:20)\n at tryOnImmediate (timers.js:768:5)\n at processImmediate [as _immediateCallback] (timers.js:745:5)"}

I registered as a "Trusted Mozilla Client" at https://oauth-stable.dev.lcip.org/console/client/register.

The failing line is https://github.com/mozilla/fxa-oauth-server/blob/237886dc0f01f976d41de840dec3143206fcf720/lib/routes/authorization.js#L241, the call to db.getScope can return undefined.