Skip to content

Elastic Beanstalk Docker build npm timeout

0

April 29 i deployed an image that built successfully. Last night I did a minor update for some backend bugs and the new image will not build. i get the following error:

#22 [16/16] RUN cd /tmp/drive/static/forms     && npm install     && npx vite build --config vite.config.prod.js     && chown -R www-data:www-data /tmp/drive/public
#22 4.965 npm warn deprecated package.json@2.0.1: Use pkg.json instead.
#22 506.4 npm error code EIDLETIMEOUT
#22 506.4 npm error Idle timeout reached for host `registry.npmjs.org:443`
#22 506.4 npm error A complete log of this run can be found in: /root/.npm/_logs/2025-05-08T14_22_46_575Z-debug-0.log
#22 ERROR: process "/bin/sh -c cd /tmp/drive/static/forms     && npm install     && npx vite build --config vite.config.prod.js     && chown -R www-data:www-data /tmp/drive/public" did not complete successfully: exit code: 1
------
 > [16/16] RUN cd /tmp/drive/static/forms     && npm install     && npx vite build --config vite.config.prod.js     && chown -R www-data:www-data /tmp/drive/public:
4.965 npm warn deprecated package.json@2.0.1: Use pkg.json instead.
506.4 npm error code EIDLETIMEOUT
506.4 npm error Idle timeout reached for host `registry.npmjs.org:443`
506.4 npm error A complete log of this run can be found in: /root/.npm/_logs/2025-05-08T14_22_46_575Z-debug-0.log
------
Dockerfile:35
--------------------
  34 |     # install npm packages
  35 | >>> RUN cd /tmp/drive/static/forms \
  36 | >>>     && npm install \
  37 | >>>     && npx vite build --config vite.config.prod.js \
  38 | >>>     && chown -R www-data:www-data /tmp/drive/public
  39 |     
--------------------
ERROR: failed to solve: process "/bin/sh -c cd /tmp/drive/static/forms     && npm install     && npx vite build --config vite.config.prod.js     && chown -R www-data:www-data /tmp/drive/public" did not complete successfully: exit code: 1

2025/05/08 14:31:11.990950 [WARN] failed to execute command: docker build -t aws_beanstalk/staging-app /var/app/staging/, retrying...

I made absolutely no configuration changes to the project and changed a total of 10 lines of code in my Django backend. As I can't reach any form of technical support with out paying and i refuse to pay for technical support I am forced to shoot a dart into the ether to see if someone who may read this actually has any idea how or why this may be happening.

I will provide any further needed documentation/config files if anyone is willing to help me with this.

Things i have tried: i tried testing connectivity to the npm registry to see if that was the issue with the following results:

curl -I https://registry.npmjs.org
HTTP/2 200
date: Thu, 08 May 2025 15:35:33 GMT
content-type: application/json
cache-control: public, immutable, max-age=31557600
set-cookie: _cfuvid=iQngu04vD0UndrUxZcTjOZ0FA.bHxS36YVkSTM42074-1746718533562-0.0.1.1-604800000; path=/; domain=.npmjs.org; HttpOnly; Secure; SameSite=None
server: cloudflare
cf-ray: 93ca0712b98c121f-PDX

it doesn't appear to be a server issue or a connectivity issue.

I have compared the previous version zip file with the one the failed and as i said the only differences are 10 lines of code and package.json has a new version number there are not other changes to the configuration of the project and/or build process.

In researching this i saw someone have a similar issue but it was a kernel bug and upgrading fixed the issue. I have verified and my kernel version is indeed an updated one and not the one that this person saw the issue on. also 2 weeks ago this kernel was able to build with no issues.

All other searches came up with nothing and Amazon IQ is the most worthless thing i've ever used in my life. I can't get a live person to even look at a log file which i find absolute ridiculous.

asked 10 months ago166 views
1 Answer
0

Based on the error message and the information provided, it appears that the issue is related to an npm installation timeout during the Docker build process in Elastic Beanstalk. This can happen due to various reasons, even if you haven't made significant changes to your project. Here are some potential solutions and things to consider:

  1. Increase the timeout for npm: You can try increasing the npm timeout by adding the following flag to your npm install command:

    npm install --network-timeout 1000000
    

    This sets the timeout to 1000 seconds (about 16 minutes).

  2. Use a package lock file: If you're not already using one, consider adding a package-lock.json or yarn.lock file to your project. This can help ensure consistent installations and potentially speed up the process.

  3. Clear npm cache: If you have access to the build environment, try clearing the npm cache:

    npm cache clean --force
    
  4. Check for network issues: While your curl test shows connectivity to the npm registry, there might be intermittent network issues. You could try building at a different time or consider using a custom Docker image with pre-installed dependencies.

  5. Review your dependencies: Make sure there are no issues with your package.json file. Sometimes, a minor update to a dependency can cause unexpected issues.

  6. Use a specific Node.js version: If you're not already specifying a Node.js version, try pinning to a specific version in your Dockerfile or Elastic Beanstalk configuration.

  7. Increase instance resources: If possible, try increasing the resources (CPU/RAM) allocated to your Elastic Beanstalk environment, as limited resources can sometimes cause timeouts.

  8. Check Elastic Beanstalk service health: Verify if there are any ongoing issues with Elastic Beanstalk in your region by checking the AWS Service Health Dashboard.

If none of these solutions work, you might need to dive deeper into your application's build process or consider reaching out to AWS support for more specialized assistance.
Sources
Node.js runtime release information - AWS App Runner

answered 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.