使用 @Sentry/NextJS在AWS放大器上使用 @Sentry/NextJ构建错误
我只是想使用 @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!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我也有一个类似的问题,这似乎源于缺少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
totrue
Update:

To edit your environmental variables, click on your app > under "App Settings" click on "Environment variables" > click the "Manage Variables" button > "Add Variable"
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.