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

fix(gatsby): Handle renderToPipeableStream errors #36555

Merged
merged 1 commit into from
Sep 7, 2022

Conversation

tyhopp
Copy link
Contributor

@tyhopp tyhopp commented Sep 7, 2022

Description

Fixes errors that get swallowed during React 18's renderToPipeableStream.

Currently the error is logged (so at least there's some info), but the stack trace and code frame don't have it.

Example component with error:

import * as React from "react"
import { Link } from "gatsby"

const IndexPage = () => {
  // This is the error
  throw new Error(`Hello`)

  return <></>
}

export default IndexPage

Current stack trace and code frame:

ERROR #95313 

Building static HTML failed

See our docs page for more info on this error: https://gatsby.dev/debug-html


  107 |         route: route,
  108 |         params: params,
> 109 |         uri: "/" + uriSegments.slice(0, index).join("/")
      | ^
  110 |       };
  111 |       break;
  112 |     }


  WebpackError: Worker exited before finishing task
  
  - utils.js:109 
    [g]/[@gatsbyjs]/reach-router/lib/utils.js:109:1
  
  - attributes.js:73 
    [g]/[css-select]/lib/attributes.js:73:1

With change:

ERROR #95313 

Building static HTML failed for path "/"

See our docs page for more info on this error: https://gatsby.dev/debug-html


  4 | const IndexPage = () => {
  5 |   // This is the error
> 6 |   throw new Error(`Hello`);
    |         ^
  7 |
  8 |   return <></>;
  9 | };


  WebpackError: Hello
  
  - index.tsx:6 
    g/src/pages/index.tsx:6:9
  
  - utils.js:64 
    [g]/[@gatsbyjs]/reach-router/lib/utils.js:64:1

Documentation

N/A

Related Issues

[sc-55337]

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Sep 7, 2022
@tyhopp tyhopp added topic: core Relates to Gatsby's core (e.g. page loading, reporter, state machine) and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Sep 7, 2022
@LekoArts LekoArts merged commit 9c5eacf into master Sep 7, 2022
@LekoArts LekoArts deleted the fix/render-to-pipeable-stream-error-handling branch September 7, 2022 06:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: core Relates to Gatsby's core (e.g. page loading, reporter, state machine)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants