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

Incorrect NEXTJS_REQUEST_ASYNC_STORAGE_MODULE_PATH in Next.js 13.4.20 #8977

Closed
3 tasks done
Burry opened this issue Sep 7, 2023 · 19 comments · Fixed by #9006
Closed
3 tasks done

Incorrect NEXTJS_REQUEST_ASYNC_STORAGE_MODULE_PATH in Next.js 13.4.20 #8977

Burry opened this issue Sep 7, 2023 · 19 comments · Fixed by #9006
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK Type: Bug

Comments

@Burry
Copy link

Burry commented Sep 7, 2023

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/nextjs

SDK Version

7.68.0

Framework Version

13.4.20

Link to Sentry event

No response

SDK Setup

npx @sentry/wizard@latest -i nextjs

Steps to Reproduce

  1. Install the Next.js canary release (yarn add next@13.4.20-canary.20) in a project using the Next.js 13 App Directory and Route Handlers.
  2. Implement the Sentry plugin in next.config.js.
  3. Run next build.
  4. Observe a console warning: The Sentry SDK could not access the RequestAsyncStorage module. Certain features may not work. There is nothing you can do to fix this yourself, but future SDK updates may resolve this.
  5. Observe an error when building each route handler wrapped by Sentry: Module not found: Can't resolve '@sentry/nextjs/build/esm/config/templates/requestAsyncStorageShim.js'

Expected Result

Next.js should successfully build all Route Handlers wrapped by Sentry

Actual Result

Identified the offending line in packages/nextjs/src/config/loaders/wrappingLoader.ts#L19, which should use next/dist/client/components/request-async-storage.external

@Burry Burry added the Type: Bug label Sep 7, 2023
@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 Sep 7, 2023
@github-actions github-actions bot added the Package: nextjs Issues related to the Sentry Nextjs SDK label Sep 7, 2023
@Burry Burry closed this as not planned Won't fix, can't repro, duplicate, stale Sep 8, 2023
@lforst
Copy link
Member

lforst commented Sep 8, 2023

@Burry Hey, thanks for reporting this. Can I ask what made you resolve this issue? Were there any learnings?

@joacub
Copy link

joacub commented Sep 8, 2023

the error is in the nextjs side aparently, they fixed at canary 13.4.20-canary.21 and broke again in 13.4.20-canary.22

@feedthejim
Copy link

It's not a breakage it's just a refactor of internal apis that Sentry is using. The change will be present from canary 22 most likely, so you should update the path you're requiring from.

@joacub
Copy link

joacub commented Sep 8, 2023

@feedthejim when you said you , are you refering to me ? or sentry team ?, cause i am not referencing that library at all in my code.

@Burry
Copy link
Author

Burry commented Sep 9, 2023

@Burry Hey, thanks for reporting this. Can I ask what made you resolve this issue? Were there any learnings?

Sure thing, reopening it now lol. Vercel initially reverted the changes that led to this issue so I closed it. I missed they took another shot at it in vercel/next.js#55139

@Burry Burry reopened this Sep 9, 2023
@Burry
Copy link
Author

Burry commented Sep 9, 2023

No real learnings though, I got frustrated trying to monkeypatch @sentry/nextjs and just stayed on the Next build that reverted the refactor

@joacub
Copy link

joacub commented Sep 11, 2023

any advance on this, we get forced to disabled sentry for now due to this, 👯‍♀️

@lforst
Copy link
Member

lforst commented Sep 12, 2023

any advance on this, we get forced to disabled sentry for now due to this, 👯‍♀️

I will note here that the SDK will always only follow the stable release cadence of Next.js. We are not making guarantees to be compatible with the canary build. If you want a stable environment, I recommend sticking to the stable versions.

@Burry
Copy link
Author

Burry commented Sep 12, 2023

any advance on this, we get forced to disabled sentry for now due to this, 👯‍♀️

I will note here that the SDK will always only follow the stable release cadence of Next.js. We are not making guarantees to be compatible with the canary build. If you want a stable environment, I recommend sticking to the stable versions.

Totally understand, this was just proactive. My team needed to run the Next canary for some critical fixes it introduced, just hoping Sentry’s good to go when Vercel :shipit:’s

@joacub
Copy link

joacub commented Sep 12, 2023

any advance on this, we get forced to disabled sentry for now due to this, 👯‍♀️

I will note here that the SDK will always only follow the stable release cadence of Next.js. We are not making guarantees to be compatible with the canary build. If you want a stable environment, I recommend sticking to the stable versions.

Got you totally understand.

@Noah-Haf
Copy link

Just updated to Next.js 13.5.1 with SDK Version 7.69.0 & I receive the error:

Module not found: Can't resolve 'next/dist/client/components/request-async-storage'

This issue doesn't seem to occur when I remove Sentry. Does everybody else experience this issue?

@jmurty
Copy link

jmurty commented Sep 20, 2023

I just upgraded our project to Next.js version 13.5.1 and the build failed with errors like these ☝️ with @sentry/next version 7.67.0, but the build succeeds locally and in Vercel deployments after we upgraded @sentry/next to 7.69.0

@lforst
Copy link
Member

lforst commented Sep 20, 2023

@Noah-Haf can you verify that you actually run version 7.69.0 of the SDK?

@Noah-Haf
Copy link

Hi @lforst,

I am indeed on the 7.69.0 version of the SDK and running it, however, I just upgraded to 7.70.0 and I'm still having the same error.

@flybayer
Copy link

flybayer commented Sep 20, 2023

I am also having the same error with nextjs 13.5.1 and @sentry/nextjs 7.70.0

@Noah-Haf
Copy link

I also tried with nextjs 13.5.2 and I still had the same behaviour as before, however, I have a fatal error while testing locally.

@lforst
Copy link
Member

lforst commented Sep 21, 2023

@flybayer @Noah-Haf Can you share the exact errors you're getting? Our tests don't run into this. Ideally, you open new issues with steps to reproduce. Thanks!

@adikari
Copy link

adikari commented Sep 21, 2023

This is happening for me too. not sure why this issue is closed? I did check the path to the file and the .external file is in the correct location since the last PR.

@lforst
Copy link
Member

lforst commented Sep 21, 2023

not sure why this issue is closed?

This issue was closed because it was fixed originally and now the error message shows up again for different reasons. In order to incentivize people to provide proper error reports and reproduction and prevent bandwaggoning I will lock this issue.

Please open a new issue with error logs and reproduction steps. Thank you!

@getsentry getsentry locked as resolved and limited conversation to collaborators Sep 21, 2023
@getsantry getsantry bot removed the status in GitHub Issues with 👀 Sep 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Package: nextjs Issues related to the Sentry Nextjs SDK Type: Bug
Projects
Archived in project
8 participants