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

(deploy/netlify) included_files in netlify.toml doesn't seem effective #909

Closed
dai-shi opened this issue Sep 27, 2024 · 2 comments · Fixed by #1126
Closed

(deploy/netlify) included_files in netlify.toml doesn't seem effective #909

dai-shi opened this issue Sep 27, 2024 · 2 comments · Fixed by #1126
Labels
help wanted Extra attention is needed

Comments

@dai-shi
Copy link
Owner

dai-shi commented Sep 27, 2024

How to reproduce: deploy 08_cookies example to Netlify

The error:

Error: ENOENT: no such file or directory, open '/var/task/netlify/private/items.json'
@dai-shi dai-shi added the help wanted Extra attention is needed label Sep 27, 2024
dai-shi added a commit that referenced this issue Sep 27, 2024
Based on #882, this fixes some plugins
- Vercel
- Netlify (Found an issue: #909)
- Deno (Found an issue: #908)
@rmarscher
Copy link
Contributor

I looked into this and it is a relative path issue. Updating the path to '../../private/items.json' gets it to work. The default fs path for functions is netlify/functions.

I think we have a few options for a solution:

  1. Include a "root path" config or env var that we can access at runtime to avoid relative paths
  2. Copy the waku private folder into the netlify folder at build and set included_files to "netlify/private/**"
  3. Change the function folder in the netlify.toml to something that is only one level deep (i.e. netlify-functions) so the ../private relative path is the same as in dev.

I have also noticed that netlify cli seems to use the monorepo root as the base path when running from the cookies example folder. I worked around it by adding the monorepo relative path in the netlify.toml:

  publish = "examples/38_cookies/dist/public"

@dai-shi
Copy link
Owner Author

dai-shi commented Jan 4, 2025

Solution 3 sounds good to me. Would you be able to open a PR?

rmarscher added a commit to rmarscher/waku that referenced this issue Jan 5, 2025
Changes the netlify functions output dir from netlify/functions
to netlify-functions.

This is a breaking change for existing netlify projects
using dynamic rendering. It requires updating netlify.toml `[functions]` section with

```
  directory = "netlify-functions"
```

In a monorepo, this needs to also include the base path from the root of the monorepo.

Fixes dai-shi#909

to the netlify.toml (or to
dai-shi pushed a commit that referenced this issue Jan 5, 2025
Changes the netlify functions output dir from netlify/functions to
netlify-functions.

This is a breaking change for existing netlify projects using dynamic
rendering. It requires updating the functions directory for existing
projects from the default "netlify/functions" to "netlify-functions".

Edit the netlify.toml `[functions]` section and set

```
  directory = "netlify-functions"
```

In a monorepo, the directory value needs to also include the base path
from the root of the monorepo.

Fixes #909
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants