Skip to content

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
Contributor

lforst commented Mar 29, 2023

Thank you for your contribution! :)

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

2 participants