Not sure if this is the right place for this. This is taken directly from the “netlify deploy logs”. I’m currently not able to deploy needed production changes.
error description
2. onBuild command from @netlify/plugin-functions-core
Packaging Functions from lambda directory:
I was using node-fetch, which I had no idea did have a conditional dependency until I read about it in one of the issue comments. I replaced that with http.get and was able to deploy successfully
The simple function I wrote does not explicitly use node-fetch, but I see the build process creates a lambda that does.
I don’t think I can change that easily. A grep of the project shows a whole series of node_modules that use node-fetch.
After some research I realized the simple require in my (Netlify) function is for a 3rd party library that DOES include node-fetch. For that library, node-fetch is its only dependency. I REALLY don’t want to try taking on modifying that library.
I don’t know if this would help you or maybe someone else who finds this thread, but this is the code that I used to replace node-fetch. It’s in TypeScript.
Something changed in the Netlify build process that now requires an additional package that was not previously required.
I got this to work with the addition of the “encoding” package (that I’d never heard of). I don’t know what changed that introduced this new requirement; all I know is by adding it to my packages.json I was able to get a build done on Netlify.
Hi, the ‘encoding’ package is a dependency of ‘node-fetch’ and has caused that error ‘on and off’ for a while now. Can you take a look at my suggestion here: Deploy failed due to an error in @netlify/plugin-functions-core plugin - #6 by Dennis and see if that works for you as well? At the very least, you won’t need to have a dependency’s dependency in your package.json file.
I don’t use node-fetch, but a package I use does. In the meantime, my project requirements have changed and I no longer need that package so the issue becomes moot.
Thanks for your response.