使用 @Sentry/NextJS在AWS放大器上使用 @Sentry/NextJ构建错误

发布于 2025-01-24 21:28:22 字数 429 浏览 1 评论 0原文

我只是想使用 @sentry/nextjs和sentry向导将Sentry与NextJS V12集成,在LocalHost和集成Sentry之前,一切都很好,但是当我在AWS Amplify上构建应用程序时,构建是错误的,当启动SSR构建与多个构建时,关于找不到的模块的错误:无法解析“ WebPack”。

构建有什么问题?有什么解决方案吗?我尝试了几种选择,例如在Next.config.js上添加Target:“实验性服务器无线”,但没有运气。

感谢您的帮助!

I’m just trying to integrate sentry with NextjS v12 using @sentry/nextjs and sentry wizard, everything is fine on localhost and before integrating Sentry, but when I build the app on AWS Amplify, the build is error when starting SSR build with multiple error regarding Module not found: Can’t resolve ‘webpack’.

What is wrong with the build? Is there any solution for this? I have tried several options like adding target: ‘experimental-serverless-trace’ on next.config.js but no luck.

Appreciate your help!

enter image description here

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

夕色琉璃 2025-01-31 21:28:22

我也有一个类似的问题,这似乎源于缺少WebPack模块。我发现修复程序是将Amplify Environmental Variable配置Amplify_Nextjs_experiention_trace <代码> true

更新:
要编辑您的环境变量,请单击您的应用程序&gt;在“应用程序设置”下,单击“环境变量”&gt;单击“管理变量”按钮&gt; “添加变量”
中显示

I had a similar issue, which seemed to stem from missing webpack modules. I found the fix was to configure the Amplify environmental variable AMPLIFY_NEXTJS_EXPERIMENTAL_TRACE to true

Update:
To edit your environmental variables, click on your app > under "App Settings" click on "Environment variables" > click the "Manage Variables" button > "Add Variable"
Environment Variable Shown in UI

辞取 2025-01-31 21:28:22

Amplify尚不支持NextJs 12。您将不得不使用11.1.4您可以在此处找到有关GitHub问题的讨论:
https://github.com/aws-aws-amplify/amplify/amplify-hosting/amplify-hosting/issues/ 2343

不能说您的错误是否100%相同,但看起来像该GitHub问题中提到的“已知问题”。

Amplify doesn't support Nextjs 12 yet. You are going to have to use 11.1.4 You can find discussion on the GitHub issue here:
https://github.com/aws-amplify/amplify-hosting/issues/2343

Can't say if your error is 100% the same but it looks like the "known issue" mentioned in that github issue.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文