Hi there! I’m running into an issue related to symlinks being incorrect when running netlify functions:server
but are correct when deployed to Netlify. Locally, it crashes before the background function has a chance to load.
◈ Failed to load function publish-charts-background: ENOENT: no such file or directory, symlink '../acorn/bin/acorn' -> '/Users/jacqueschrag/Documents/projects/axios-hermes-svelte/.netlify/functions-serve/publish-charts-background/netlify/functions/chart_template/node_modules/.bin/acorn'
› Error: Netlify CLI has terminated unexpectedly
This is a problem with the Netlify CLI, not with your application.
If you recently updated the CLI, consider reverting to an older version by running:
npm install -g netlify-cli@VERSION
In my setup, I have a directory /chart_template
that sits at the project root that I’m referencing in my /netlify/functions/publish-charts-background.mjs
function.
I’m struggling to find a workaround that doesn’t require me to manually copy & paste /chart_template
into the generated /.netlify/functions-serve/publish-charts-background/
directory.
I’ve noticed that if I remove the included_files
setting from my netlify.toml
file, it works just fine locally - but then will break in production.
[dev]
targetPort = 5173
[build]
command = 'npm run build'
publish = 'build'
[functions]
node_bundler = "esbuild"
included_files = ["chart_template/**"]
external_node_modules = ["esbuild", "esbuild-sass-plugin"]
directory = "netlify/functions"
I’m wondering if there is a way for me to only set the included_files
property in the production environment, and not have it on dev. Something like this, maybe?
[dev]
targetPort = 5173
[build]
command = 'npm run build'
publish = 'build'
[functions]
node_bundler = "esbuild"
included_files = ["chart_template/**"]
external_node_modules = ["esbuild", "esbuild-sass-plugin"]
directory = "netlify/functions"
[functions.dev]
included_files = []
Thanks in advance for any guidance here!