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

Getting internal server error (502 Bad Gateway) #22

Closed
colehorvitz opened this issue Dec 4, 2023 · 7 comments
Closed

Getting internal server error (502 Bad Gateway) #22

colehorvitz opened this issue Dec 4, 2023 · 7 comments

Comments

@colehorvitz
Copy link

Hello,
I have deployed the solution as described by the tutorial. When I arrive at the part which says, " To verify that it is working properly, test the following optimized image URL https:// YOURDISTRIBUTION.cloudfront.net/images/rio/1.jpeg?format=auto&width=300", I go to the URL and receive a 502 server error (bad gateway). The screen says "internal server error". Any ideas?

The X-Amz-Cf-Id is 59DzRpe8853TUlsoAlUELQiFMzgGS1dPLRgsDw_9bQHQ_2JcGXdt6A==

@achrafsouk
Copy link
Contributor

can you please share the error in the Lambda log?

@colehorvitz
Copy link
Author

ah, seems like it's the same issue mentioned here #7 (comment)

"Error: Could not load the "sharp" module using the linux-x64 runtime"

But I am running npm run build :/

@achrafsouk
Copy link
Contributor

I suspect that this is because the machine your running the build on is different from the Lambda's.

What is the machine characteristics you are running the build on?

@polo4096
Copy link

polo4096 commented Dec 6, 2023

Hey !
I also had some troubles making it work yesterday, I was installing sharp from MacOS ARM chip and couldn't make it work for x64 arch, so instead I used a lambda layer for sharp library and it worked out of the box.
@achrafsouk It seems that the prebuild command is somehow deprecated for M1/M2 users

@achrafsouk
Copy link
Contributor

yeah better build it on an EC2 instance with similar CPU architecture as Lambda. I'll note it in the readme.

@piotrekwitkowski
Copy link
Contributor

There is currently an open issue in npm that prevents you from installing platform-specific dependencies (like sharp for x64 arch on Mac with ARM chips): npm/cli#4828 - please upvote the issue if you are experiencing similar problems.

@ClementCardonnel
Copy link

ClementCardonnel commented Jun 7, 2024

Hello, I've encountered this error too… I'm a beginner regarding AWS and I don't know how I could do a build on an EC2 instance… Could someone point me in the right direction?

EDIT: This answer was helpful: #35 (comment)

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

5 participants