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(nextjs): Gracefully handle undefined beforeFiles in rewrites #7649

Merged
merged 3 commits into from Mar 29, 2023

Conversation

bertho-zero
Copy link
Contributor

fix error:

> Build error occurred
TypeError: originalRewritesResult.beforeFiles is not iterable
    at userNextConfig.rewrites (/home/bertho/dev/oa/node_modules/@sentry/nextjs/cjs/config/withSentryConfig.js:107:66)
    at async loadRewrites (/home/bertho/dev/oa/node_modules/next/dist/lib/load-custom-routes.js:401:23)
    at async Promise.all (index 1)
    at async Object.loadCustomRoutes [as default] (/home/bertho/dev/oa/node_modules/next/dist/lib/load-custom-routes.js:13:44)
    at async Span.traceAsyncFn (/home/bertho/dev/oa/node_modules/next/dist/trace/trace.js:79:20)
    at async /home/bertho/dev/oa/node_modules/next/dist/build/index.js:79:34
    at async Span.traceAsyncFn (/home/bertho/dev/oa/node_modules/next/dist/trace/trace.js:79:20)
    at async Object.build [as default] (/home/bertho/dev/oa/node_modules/next/dist/build/index.js:65:29)

Before submitting a pull request, please take a look at our
Contributing guidelines and verify:

  • If you've added code that should be tested, please add tests.
  • Ensure your code lints and the test suite passes (yarn lint) & (yarn test).

fix error:

```
> Build error occurred
TypeError: originalRewritesResult.beforeFiles is not iterable
    at userNextConfig.rewrites (/home/bertho/dev/oa/node_modules/@sentry/nextjs/cjs/config/withSentryConfig.js:107:66)
    at async loadRewrites (/home/bertho/dev/oa/node_modules/next/dist/lib/load-custom-routes.js:401:23)
    at async Promise.all (index 1)
    at async Object.loadCustomRoutes [as default] (/home/bertho/dev/oa/node_modules/next/dist/lib/load-custom-routes.js:13:44)
    at async Span.traceAsyncFn (/home/bertho/dev/oa/node_modules/next/dist/trace/trace.js:79:20)
    at async /home/bertho/dev/oa/node_modules/next/dist/build/index.js:79:34
    at async Span.traceAsyncFn (/home/bertho/dev/oa/node_modules/next/dist/trace/trace.js:79:20)
    at async Object.build [as default] (/home/bertho/dev/oa/node_modules/next/dist/build/index.js:65:29)
```
@lforst lforst self-requested a review March 29, 2023 13:22
@lforst lforst changed the title fix withSentryConfig.ts when beforeFiles is not defined fix(nextjs): Gracefully handle undefined beforeFiles in rewrites Mar 29, 2023
@lforst
Copy link
Member

lforst commented Mar 29, 2023

Thank you for your contribution! :)

@lforst lforst merged commit ca704ef into getsentry:master Mar 29, 2023
29 checks passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants