Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in npm run build does not return error code #39

Open
sattaman opened this issue Jul 6, 2017 · 7 comments
Open

Error in npm run build does not return error code #39

sattaman opened this issue Jul 6, 2017 · 7 comments

Comments

@sattaman
Copy link

sattaman commented Jul 6, 2017

I've recently had an error where my check to find if it is running in JSDOM failed, and the build failed, but my CI server didnt know as this was not returned as an error. I'm not sure if the issue is here or in CRA?

2017-07-06T10:55:20.1494827Z Error: Uncaught [ReferenceError: sessionStorage is not defined]
2017-07-06T10:55:20.1494827Z     at reportException (C:\VSO Agent Geoff\_work\119\s\node_modules\jsdom\lib\jsdom\living\helpers\runtime-script-errors.js:58:24)
2017-07-06T10:55:20.1494827Z     at processJavaScript (C:\VSO Agent Geoff\_work\119\s\node_modules\jsdom\lib\jsdom\living\nodes\HTMLScriptElement-impl.js:130:7)
2017-07-06T10:55:20.1494827Z     at HTMLScriptElementImpl._eval (C:\VSO Agent Geoff\_work\119\s\node_modules\jsdom\lib\jsdom\living\nodes\HTMLScriptElement-impl.js:65:7)
2017-07-06T10:55:20.1494827Z     at C:\VSO Agent Geoff\_work\119\s\node_modules\jsdom\lib\jsdom\browser\resource-loader.js:31:22
2017-07-06T10:55:20.1494827Z     at Object.check (C:\VSO Agent Geoff\_work\119\s\node_modules\jsdom\lib\jsdom\living\nodes\Document-impl.js:89:11)
2017-07-06T10:55:20.1494827Z     at C:\VSO Agent Geoff\_work\119\s\node_modules\jsdom\lib\jsdom\living\nodes\Document-impl.js:108:12
2017-07-06T10:55:20.1494827Z     at wrappedEnqueued (C:\VSO Agent Geoff\_work\119\s\node_modules\jsdom\lib\jsdom\browser\resource-loader.js:255:16)
2017-07-06T10:55:20.1651068Z     at Request.request [as _callback] (C:\VSO Agent Geoff\_work\119\s\node_modules\jsdom\lib\jsdom\browser\resource-loader.js:203:9)
2017-07-06T10:55:20.1651068Z     at Request.self.callback (C:\VSO Agent Geoff\_work\119\s\node_modules\request\request.js:188:22)
2017-07-06T10:55:20.1651068Z     at emitTwo (events.js:106:13) ReferenceError: sessionStorage is not defined
2017-07-06T10:55:20.1651068Z     at Function.get (http://localhost:50813/static/js/main.8f3473ef.js:1:674766)
2017-07-06T10:55:20.1651068Z     at new t (http://localhost:50813/static/js/main.8f3473ef.js:1:985225)
2017-07-06T10:55:20.1651068Z     at new t (http://localhost:50813/static/js/main.8f3473ef.js:1:973460)
2017-07-06T10:55:20.1651068Z     at Object.<anonymous> (http://localhost:50813/static/js/main.8f3473ef.js:1:117584)
2017-07-06T10:55:20.1651068Z     at t (http://localhost:50813/static/js/main.8f3473ef.js:1:101)
2017-07-06T10:55:20.1651068Z     at Object.<anonymous> (http://localhost:50813/static/js/main.8f3473ef.js:1:463196)
2017-07-06T10:55:20.1651068Z     at t (http://localhost:50813/static/js/main.8f3473ef.js:1:101)
2017-07-06T10:55:20.1651068Z     at Object.<anonymous> (http://localhost:50813/static/js/main.8f3473ef.js:1:464023)
2017-07-06T10:55:20.1651068Z     at t (http://localhost:50813/static/js/main.8f3473ef.js:1:101)
2017-07-06T10:55:20.1651068Z     at Object.<anonymous> (http://localhost:50813/static/js/main.8f3473ef.js:1:6590)
2017-07-06T10:55:20.1651068Z ­ƒöÑ 'render' from react-snapshot was never called. Did you replace the call to ReactDOM.render()?
2017-07-06T10:55:20.1651068Z ­ƒò©   Finished crawling.
2017-07-06T10:55:20.1807357Z ##[debug]rc:0
2017-07-06T10:55:20.1807357Z ##[debug]success:true
2017-07-06T10:55:20.1807357Z ##[debug]Npm command succeeded with code: 0
2017-07-06T10:55:20.1807357Z ##[debug]cleaning up...
2017-07-06T10:55:20.1807357Z ##[debug]task result: Succeeded
@mnemanja
Copy link

mnemanja commented Nov 6, 2017

Hi @sattaman,
have you resolved this issue, and if so, how?

I've implemented local and session storages and started getting the same error.

@sattaman
Copy link
Author

sattaman commented Nov 6, 2017

I used the code below to check for jsdom and avoid referencing sessionStorage in jsdom enviroments.

export const isJsDom = () => typeof navigator !== "undefined" &&
  (navigator.userAgent.includes("Node.js") ||
    navigator.userAgent.includes("jsdom"));

@mnemanja
Copy link

mnemanja commented Nov 6, 2017

Thanks!

That's a nice workaround, but I actually need the storage in production :(

@sattaman
Copy link
Author

sattaman commented Nov 6, 2017

This doesnt stop you using storage in production , you only disable it while react-snapshot is extracting you pages markup

@mnemanja
Copy link

mnemanja commented Nov 6, 2017

I see. Thanks!
While this works, it's a workaround, and I'd like to know if this is planned to be fixed, or is this workaround the suggested way of handling this issue.

Cheers.

@stereobooster
Copy link

Jsdom issue won't be solved see #44 (comment)

@mnemanja
Copy link

mnemanja commented Nov 6, 2017

Thanks 4 the update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants