react-server icon indicating copy to clipboard operation
react-server copied to clipboard

`UnhandledPromiseRejectionWarning` in react-server-website

Open davidalber opened this issue 8 years ago • 3 comments

Reproduction

  1. Follow the instructions in the react-server-website README:
$ git clone [email protected]:redfin/react-server.git
$ cd react-server
$ npm run bootstrap
$ cd packages/react-server-website
$ npm run build-assets
$ npm start
  1. Navigate to http://localhost:3010 in a browser.

Bug

The following appears in the service log:

2017-01-19T07:47:45.564Z - error: [react-server-data-bundle-cache.main]  name=react-server-data-bundle-cache, message=RLS() access
 outside of request!, stack=Error: RLS() access outside of request!
    at react-server/node_modules/request-local-storage/lib/server/index.js:26:35
    at getCurrentRequestContext (context/RequestContext.js:19:10)
    at exports.default (react-server/packages/react-server-data-bundle-cache/lib/listen.js:10:12)
    at before (react-server/packages/react-server-data-bundle-cache/lib/before.js:25:2)
    at react-server/node_modules/continuation-local-storage/context.js:84:17
    at _fulfilled (react-server/node_modules/q/q.js:834:54)
    at self.promiseDispatch.done (react-server/node_modules/q/q.js:863:30)
    at Promise.promise.promiseDispatch (react-server/node_modules/q/q.js:796:13)
    at react-server/node_modules/q/q.js:857:14
    at runSingle (react-server/node_modules/q/q.js:137:13)
2017-01-19T07:47:45.569Z - fast: [react-server-data-bundle-cache.main] stats.error.returned ms=14
(node:69432) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error: RLS() access outside of request!

So far as I can see, the site is loading fine. There's nothing concerning in the JavaScript console.

Produced using Node v6.9.4, npm v3.10.10.

davidalber avatar Jan 19 '17 07:01 davidalber

Thanks for reporting @davidalber.

gigabo avatar Jan 19 '17 22:01 gigabo

How do we feel about deploying a new version of the website while this bug exists? I couldn't detect any usability issues, but I didn't look very thoroughly.

davidalber avatar Feb 10 '17 01:02 davidalber

I haven't looked into this yet because I'm working on an enhancement to ReactServerAgent right now, but when I was working on #869 I ran into this same error with react-server-cli. You can see my basic fix here. Essentially, what I found was that react-server-cli broke the promise chain in this line:

cli.parseCliArgs().then(cli.run).catch(console.error);

cli.run for all commands except start had an implicit return value, so the promise chain continued without issue. The start command, however, returned an object structure instead of a promise. So, I slipped in a little fix that returned the started promise if the command was start, otherwise it continued to do the same thing as before.

This might fix the issue that you're seeing in the website package as well. FWIW, it took me about an hour to track the issue down.

drewpc avatar Feb 10 '17 01:02 drewpc