Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

netlify adapter breaks with npm workspaces/monorepo #309

Closed
1 task
mashehu opened this issue Jun 28, 2024 · 0 comments · Fixed by #313
Closed
1 task

netlify adapter breaks with npm workspaces/monorepo #309

mashehu opened this issue Jun 28, 2024 · 0 comments · Fixed by #313
Assignees

Comments

@mashehu
Copy link

mashehu commented Jun 28, 2024

Astro Info

Astro                    v4.11.3
Node                     v20.15.0
System                   macOS (arm64)
Package Manager          npm
Output                   static
Adapter                  none
Integrations             none

Describe the Bug

I have a monorepo set up with astro subsites located in sites/* including a site rendered in hybrid mode with located at sites/pipeline-results.

This worked fine with @astrojs/netlify@5.3.2, but is broken for 5.3.3. The build log is clean, but when I go to the site, I get the following function log entry

Jun 28, 10:40:59 AM: 2024-06-28T08:40:59.297Z	undefined	
    ERROR	Uncaught Exception 	
{
  "errorType": "Error",
  "errorMessage": "Cannot find module '/var/task/sites/pipeline-results/.netlify/build/entry.mjs' imported from /var/task/ssr.mjs",
  "code": "ERR_MODULE_NOT_FOUND",
  "url": "file:///var/task/sites/pipeline-results/.netlify/build/entry.mjs",
  "stack":
    [
      "Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/var/task/sites/pipeline-results/.netlify/build/entry.mjs' imported from /var/task/ssr.mjs",
      "    at finalizeResolution (node:internal/modules/esm/resolve:269:11)",
      "    at moduleResolve (node:internal/modules/esm/resolve:937:10)",
      "    at moduleResolveWithNodePath (node:internal/modules/esm/resolve:1161:14)",
      "    at defaultResolve (node:internal/modules/esm/resolve:1204:79)",
      "    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:383:12)",
      "    at ModuleLoader.resolve (node:internal/modules/esm/loader:352:25)",
      "    at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:227:38)",
      "    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:87:39)",
      "    at link (node:internal/modules/esm/module_job:86:36)",
    ],
}

Jun 28, 10:40:59 AM: INIT_REPORT Init Duration: 270.75 ms	Phase: invoke	Status: error	Error Type: Runtime.Unknown
Jun 28, 10:40:59 AM: Unknown application error occurred

My guess is that [@astrojs/netlify] Bundling function ../../build/entry.mjs is putting it not at the desired location, because the build happens inside sites/pipeline-results (using npm run build -w sites/pipeline-results)

I created a MRE at https://github.com/mashehu/monorepo-minimal, with the corresponding netlify build: https://spiffy-toffee-620664.netlify.app/

What's the expected result?

that the SSR deployment works on netlify. 🙂

Link to Minimal Reproducible Example

https://stackblitz.com/~/github.com/mashehu/monorepo-minimal

Participation

  • I am willing to submit a pull request for this issue.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants