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

Site fails to execute functions within a pnpm monorepo #470

Open
robations opened this issue Nov 28, 2024 · 2 comments
Open

Site fails to execute functions within a pnpm monorepo #470

robations opened this issue Nov 28, 2024 · 2 comments
Labels
type: bug code to address defects in shipped code

Comments

@robations
Copy link

Describe the bug A clear and concise description of what the bug is.

Although static assets are served by netlify serve, no functions seem to be working and the index of the site (http://localhost:8888/) returns "404 Not Found".

To Reproduce Steps to reproduce the behavior:

  1. Generate a new site npx create-remix@latest --template netlify/remix-template
  2. (choosing functions, rather than edge)
  3. Test the site working
  4. Translocate site as a workspace within a pnpm monorepo:
    a. add missing dependencies (pnpm complains about react and react-dom missing)
    b. I had an issue with netlify-cli trying to run an unrelated workspace package (which also happens to have a netlify.toml file): added build.base: "packages/remix-netlify"
    c. tsconfigPaths was reporting errors in unrelated packages (added root parameter)
    d. Delete package-lock.json and node_modules
    e. Reinstall repo deps with pnpm i
  5. Test the site within monorepo working correctly with remix vite:dev
  6. netlify serve fails with 404 error at root of site and .netlify/functions-serve is missing (compared with original site)
  7. Static client assets are served correctly (favicon.ico and CSS/JS under /assets/...)

Expected behavior A clear and concise description of what you expected to happen.

The site should work within a monorepo, or would expect some simple configuration to make it work.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: MacOS
  • Browser: n/a
  • Version: @netlify/remix-adapter: 2.5.1

Smartphone (please complete the following information):

  • Device: n/a
  • OS: n/a
  • Browser n/a
  • Version n/a

Additional context Add any other context about the problem here.

Can potentially create a new monorepo for testing if not easily reproducible.

It seems like part of the Netlify code is still mis-identifying a path, but it's not clear what or where.

@robations
Copy link
Author

Notable difference:

.netlify within monorepo:

image

.netlify in isolated site:

image

@robations
Copy link
Author

I've also just noticed that if I add build.base: "packages/remix-netlify" I get a spurious nested directory added within the workspace package:

image

Whereas without build.base, the netlify CLI gets very confused about paths (tries to build within packages/foo even though it is filtered to packages/remix-netlify).

For context, I have something like 15 other netlify sites working correctly within this repo.

@serhalp serhalp added the type: bug code to address defects in shipped code label Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

2 participants