Skip to content

@sentry/gatsby build can fail with "TypeError: invokeErr is not a function" when paired with @sentry/webpack-plugin 5.1.1 #20043

Description

@robbie-goacher

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/gatsby

SDK Version

10.46.0

Framework Version

Gatsby 5.16.1

Link to Sentry event

No response

Reproduction Example/SDK Setup

No response

Steps to Reproduce

Install:

  • @sentry/gatsby: 10.46.0
  • gatsby: 5.16.1

Run a Gatsby build which will trigger a Sentry error and observe that the build will fail with this error:

error UNHANDLED REJECTION invokeErr is not a function
TypeError: invokeErr is not a function
at Object.errorHandler ([repo]/node_modules/@sentry/gatsby/gatsby-node.js:58:13)
at handleRecoverableError ([repo]/node_modules/@sentry/bundler-plugin-core/dist/cjs/index.js:5728:48)
at async Object.uploadSourcemaps ...

This is because the error handler code (in @sentry/gatsby/gatsby-node.js:58:13) is passing two arguments:

errorHandler(err, invokeErr) {
...
invokeErr(err);
}

However, the recently updated @sentry/bundler-plugin-core calls options.errorHandler with only a single Error argument:

options.errorHandler(unknownError)

This mismatch causes builds to fail because invokeErr is undefined.

Expected Result

The real/underlying Sentry error should be surfaced rather than the build failing due to this issue. It should not fail with "invokeErr is not a function".

Actual Result

The error is not handled and the build process fails.

Additional Context

Suggested fix: update the errorHandler in @sentry/gatsby to match the updated webpack plugin API.

Priority

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions