I have written a function that works in production but cannot get it to work locally.
Notice the function is loaded but when called, cannot be found.
Screenshot of directory structure
toml file
[context.production]
command = "make production"
[context.staging]
command = "make staging"
[functions]
node_bundler = "esbuild"
[build.processing]
skip_processing = false
[build.processing.css]
bundle = true
minify = true
[build.processing.js]
bundle = true
minify = true
[build.processing.html]
pretty_urls = true
[build.processing.images]
compress = false
Hey @hashmaster3k
Functions are only accessible via the Netlify CLI dev port (8888
by default), though it appears you are trying to access the function via the Jekyll dev port 4000
.
@coelmay
I’ve updated my toml as such:
[dev]
port = 8888
command = "bundle exec jekyll serve --port 8888"
When running netlify dev
I now see: “Server address: http://127.0.0.1:8888”. However, I still get the function not found error.
You are instructing Jekyll to run on port 8888
which means Netlify CLI cannot run on it. Remove this new configuration.
When you run netlify dev
does the terminal output finish with the line Server now ready on http://localhost:8888
?
I.E.
I do not see that box/message. See below for what is displayed after running netlify dev
Then Netlify dev server is not starting correctly. This is possibly an issue with the configuration of the project, or an issue with Netlicy CLI.
Thanks I will open an issue on the the repository.
If anyone else run’s into this issue, this ticket identifies that running node 17 or higher is the issue. Downgrading to node 16 solves the problem.
1 Like
Thanks for coming back and sharing that, @hashmaster3k. Glad you found a solution. Happy building