Open jonahallibone opened 3 years ago
While I'm here, I'd love some clarification on useServerlessTraceTarget
. It seems like it was removed from the input's table in the readme.md
but it's mentioned immediately below for making lighter pages. It seems like Vercel deprecated it sometimes, and other times it seems like it's still in use? The Sentry documentation, for instance, explicitly recommends it. If you have any more info that'd be great!
I think it has to do with serverless trace using the NFT module to trace dependencies rather than webpack. But I thought Vercel had already deprecated their serverless trace target because they changed code splitting to be more efficient that it's no longer needed? (that's why you see the chunks in .next/serverless/chunks/...
)
Do you know where else it's being used by Vercel?
I think you can resolve by adding webpack to your dependencies, but seems like a problem on Next.js side? As we don't use webpack in this component. It looks like @next/react-refresh-utils
(per your logs) may need it: https://github.com/vercel/next.js/blob/canary/packages/react-refresh-utils/package.json
For sentry, I don't use it but I'm guessing why it needs experimental-serverless-trace
is because it could not be bundled correctly via webpack. Serverless trace was supposed to create trace all the dependencies and generate a node_modules
. If you are using Sentry and it's not working, it may possible neednode_modules/@sentry/nextjs
into the lambda directories?
@dphang I'm not sure if this will effect this project at all, but I was just in a webinar with Vercel + Sentry, and a Vercel Dev mentioned their new tracing for the serverless
target will be landing in this next release. It seems it was based off of experimental-severless-trace
despite what I've read from maintainers of next over the past year. It's currently available in the canary version of next, I wonder if that might break this projects build in some way?
I'm also running into this exact issue. The issue only comes up when we try to import @sentry/next
into our project. This ends up breaking our builds with webpack not found
error.
I don't specify a target
in my nextjs config so I'm assuming it's using the default (server
).
I tried to add the useServerlessTrace: true
option and the build passed but instantly our site broke with a Cloudfront 503 error. I wasn't able to debug because I had to rollback instantly.
@jonahallibone @dphang is there something else I can try? I went down the rabbit hole of adding webpack, then it kept asking me to install dependencies and it was just never ending so I stopped doing that.
@odannyc using experimental-serverless-trace
worked for me. On Vercel, not using any options for target
at all also worked fine. But I am still curious if @dphang could perhaps remove the target
configuration altogether and see what happens, as that key in next.config.js
is deprecated entirely. I believe the default traced output should work, even if for some people the tree shaking doesn't work properly for MUI
.
Issue Summary
When deploying, it fails with the error
Actual behavior
I removed
useServerlessTrace
option and I am not unable to build and deploy my application. I'd prefer to not put it back.Steps to reproduce
Attempt building with
useServerlessTrace
optionScreenshots/Code/Configuration/Logs
serverless.yml
Versions
I've tried on every version since 3.4.0-alpha.1, including the new alpha's using
npx @sls-next/serverless-patched --debug
Checklist
latest
oralpha
@sls-next/serverless-component
release version, which may have already fixed your issue or implemented the feature you are trying to use. Note that the oldserverless-next.js
component and theserverless-next.js
plugin are deprecated and no longer maintained.