Update Next example
Adds the webpack config override to get around an issue when a dependency depends on https://www.npmjs.com/package/process, causing the middleware compilation to load the browser shim.
This is specifically for middleware?
This is specifically for middleware?
yes
I see. Can you give some ways I can test this? When does this happen?
I see. Can you give some ways I can test this? When does this happen?
Sorry it took so long to get around to this. Here's an example of the issue: https://github.com/VirtuaBoza/sst-process-repro/blob/main/src/middleware.ts#L5-L11
Attempting to access sst Resources in Next middleware will throw "X is not linked" because an NPM package called "process" is installed in node_modules and sst is importing from "process" without specifying "node:process" due to issues with other runtimes. Next's middleware/edge webpack config is picking up the browser implementation from that package.
The NPM package I'm referencing is: https://www.npmjs.com/package/process That package is a dependency of some popular libraries such as Cypress.
Oh I see. Is there a downside to SST using node:process internally instead of process?
we are moving sst/ion -> sst/sst and unfortunately this is going to be a messy process because of github's limitations
i'm going to close this PR for now and it can be re-opened in the new sst/sst repo that will be ready in the next few days if still relevant