I have a monorepo and am trying to deploy one of the packages to Netlify. The netlify deploy --build
command succeeds (makes it all the way through without logging any obvious errors and spits out the deployed URL at the end), but the site clearly doesn’t work. It is a NextJS site and I’m using pnpm to manage dependencies. Everything was working great until the recent update to v5 of the runtime. Locally, everything still works (aside from a weird issue where every time I run the netlify deploy --build
command I end up having to do a pnpm install --force
for it to successfully build again).
Here’s my netlify.toml
[build]
command = "pnpm check-deps && pnpm run --filter=@engage-flow-common/core --filter=@engage-flow-common/ui --filter=engage-flow-runtime build && cd apps/engage-flow-runtime && cp -v site.json .next/ & cd ../.."
publish = "apps/engage-flow-runtime/.next/"
little oddity - if I include the
[[plugins]]
package = "@netlify/plugin-nextjs"
I get an error saying that I’ve listed the plugin twice - which isn’t true. In fact, I had to remove the Runtime setting from the UI as well to get it to go away.
I have the Base folder set to (empty) in the Netlify UI and the Package folder set to apps/engage-flow-runtime
.
check-deps
just looks up some of the dependency package references and makes sure they’re the same version between a few packages. That’s working ok. The part of the command at the end is just moving a file at the root of the package directory into the .next folder so it gets bundled and deployed along with the rest of the code. It’s a data file for my app.
Here’s the output of the netlify cli (with verbose output in case that helps):
build log.zip (9.4 KB)
I feel like the number of functions it’s finding/creating is less than I was previously used to seeing, but regardless, everything looks green from here. However, as you can see from visiting the site, it is crashing and here’s what the functions logs say:
Jul 30, 10:20:09 AM: 2024-07-30T14:20:09.386Z undefined ERROR Uncaught Exception {"errorType":"Error","errorMessage":"Cannot find package '\u000bar\taskappsengage-flow-runtime' imported from /var/task/___netlify-server-handler.mjs","code":"ERR_MODULE_NOT_FOUND","stack":["Error [ERR_MODULE_NOT_FOUND]: Cannot find package '\u000bar\taskappsengage-flow-runtime' imported from /var/task/___netlify-server-handler.mjs"," at new NodeError (node:internal/errors:405:5)"," at packageResolve (node:internal/modules/esm/resolve:965:9)"," at moduleResolve (node:internal/modules/esm/resolve:1022:20)"," at moduleResolveWithNodePath (node:internal/modules/esm/resolve:876:12)"," at defaultResolve (node:internal/modules/esm/resolve:1255:79)"," at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:404:12)"," at ModuleLoader.resolve (node:internal/modules/esm/loader:373:25)"," at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:250:38)"," at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:39)"," at link (node:internal/modules/esm/module_job:75:36)"]}
Jul 30, 10:20:09 AM: INIT_REPORT Init Duration: 344.06 ms Phase: invoke Status: error Error Type: Runtime.Unknown
Jul 30, 10:20:09 AM: Unknown application error occurred
Runtime.Unknown
Jul 30, 10:20:09 AM: 0ae1a7fa Duration: 469.14 ms Memory Usage: 25 MB
Jul 30, 10:20:10 AM: 2024-07-30T14:20:10.185Z undefined ERROR Uncaught Exception {"errorType":"Error","errorMessage":"Cannot find package '\u000bar\taskappsengage-flow-runtime' imported from /var/task/___netlify-server-handler.mjs","code":"ERR_MODULE_NOT_FOUND","stack":["Error [ERR_MODULE_NOT_FOUND]: Cannot find package '\u000bar\taskappsengage-flow-runtime' imported from /var/task/___netlify-server-handler.mjs"," at new NodeError (node:internal/errors:405:5)"," at packageResolve (node:internal/modules/esm/resolve:965:9)"," at moduleResolve (node:internal/modules/esm/resolve:1022:20)"," at moduleResolveWithNodePath (node:internal/modules/esm/resolve:876:12)"," at defaultResolve (node:internal/modules/esm/resolve:1255:79)"," at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:404:12)"," at ModuleLoader.resolve (node:internal/modules/esm/loader:373:25)"," at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:250:38)"," at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:39)"," at link (node:internal/modules/esm/module_job:75:36)"]}
Jul 30, 10:20:10 AM: INIT_REPORT Init Duration: 345.56 ms Phase: invoke Status: error Error Type: Runtime.Unknown
Jul 30, 10:20:10 AM: Unknown application error occurred
Runtime.Unknown
Jul 30, 10:20:10 AM: 4ddc9290 Duration: 455.39 ms Memory Usage: 25 MB
Any guidance?