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

Unable to deploy; Error while deploying functions #24

Closed
bestpricedin opened this issue Apr 29, 2019 · 6 comments
Closed

Unable to deploy; Error while deploying functions #24

bestpricedin opened this issue Apr 29, 2019 · 6 comments

Comments

@bestpricedin
Copy link

Hi,
I forked a repo at https://github.com/bestpricedin/create-react-app-lambda, changed babel-loader version as "babel-loader": "8.0.5", using yarn.
I am using netlify-cli to run this locally and it works.
When I deploy to netlify, I get following error. Can you please help me solve the error?
My netlify -v is netlify-cli/2.11.14 darwin-x64 node-v8.15.0

12:55:51 PM: Starting to prepare functions from 'build'
12:55:51 PM: Zipping functions from /opt/build/repo/built-lambda to /tmp/zisi-889841717
12:55:52 PM: Error: Could not find "encoding" module in file: /repo/built-lambda/async-dadjoke.js. 
         
Please ensure "encoding" is installed in the project.
12:55:52 PM: Failing build: Failed to prepare functions for deployment
12:55:52 PM: failed during stage 'preparing functions for deployment': exit status 1
12:55:52 PM: Finished processing build request in 54.037857466s
12:55:52 PM: Shutting down logging, 0 messages pending
@bestpricedin
Copy link
Author

I was able to solve this by installing encoding as dependency.

@swyxio
Copy link
Contributor

swyxio commented Apr 29, 2019

node-fetch has a hidden dependency on encoding. very annoying.

@swyxio
Copy link
Contributor

swyxio commented Apr 29, 2019

we will switch to axios someday. pr welcome

@stevenjchang
Copy link
Contributor

I ran into this issue just now as well, trying to deploy this repo directly after cloning.

I cloned this repo months ago, same node-fetch version("2.3.0"), and it deployed with no issues, so I'm not sure I understand what changed. I also solved it by adding encoding as a dependency.

Is everyone having this error?

@sw-yx
Do you think the encoding package should just be included in repo itself for now? Or it's just a few people with this issue?

5:16:44 PM: Function Dir: /opt/build/repo/built-lambda
5:16:44 PM: TempDir: /tmp/zisi-828681410
5:16:45 PM: Prepping functions with zip-it-and-ship-it 0.3.1
5:16:46 PM: Error: Could not find "encoding" module in file: /repo/built-lambda/async-dadjoke.js.
5:16:46 PM: Please ensure "encoding" is installed in the project.
5:16:46 PM: Error prepping functions
5:16:46 PM: Error running command: Build script returned non-zero exit code: 1
5:16:46 PM: Failing build: Failed to build site
5:16:46 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
5:16:46 PM: Finished processing build request in 1m5.445676244s
5:16:46 PM: Shutting down logging, 0 messages pending

@swyxio
Copy link
Contributor

swyxio commented May 31, 2019

i'm not sure to be honest. it does sound like this issue appears irregularly. the node-fetch team buried it deep in their docs: node-fetch/node-fetch#412 (comment)

tbh i would rather just switch to axios. dont want to be blamed for node-fetch's problems.

@swyxio
Copy link
Contributor

swyxio commented May 31, 2019

i have switched it out to axios 82de3f7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants