AWS App Runner - how do I view /root/.npm/_logs/___-debug.log after build failure?

0

I'm using AWS App Runner to deploy a Node app, using the Node v18 environment provided by App Runner via the source code based deploy method.

My deploys started to fail and rollback to the last known good deploy, and through repetitive trial and error I was able to identify that an update I made to a handful of npm packages that was causing the failure.

The logs returned by the build process unfortunately do not include details about the failure.

How do I view the log in /root/.npm/_logs/2024-04-16T07_41_12_352Z-debug-0.log after these deploy failures?

Doesn't seem like this log is pulled back to Cloudwatch. Bolded line below from a snippet of the logs for reference.

04-16-2024 03:44:23 AM [Build] ✔ Server built in 23042ms
04-16-2024 03:44:23 AM [Build] [nitro] ✔ Generated public .output/public
04-16-2024 03:44:23 AM [Build] [nitro] ℹ Building Nuxt Nitro server (preset: node-server)
04-16-2024 03:44:23 AM [Build] [nitro] ✔ Nuxt Nitro server built
04-16-2024 03:44:23 AM [Build] npm notice 
04-16-2024 03:44:23 AM [Build] npm notice New minor version of npm available! 10.2.4 -> 10.5.2
04-16-2024 03:44:23 AM [Build] npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.5.2>
04-16-2024 03:44:23 AM [Build] npm notice Run `npm install -g npm@10.5.2` to update!
04-16-2024 03:44:23 AM [Build] npm notice 
04-16-2024 03:44:23 AM [Build] npm ERR! path /app
04-16-2024 03:44:23 AM [Build] npm ERR! command failed
04-16-2024 03:44:23 AM [Build] npm ERR! signal SIGKILL
04-16-2024 03:44:23 AM [Build] npm ERR! command sh -c npm install && npm run build
04-16-2024 03:44:23 AM [Build] 
**04-16-2024 03:44:23 AM [Build] npm ERR! A complete log of this run can be found in: /root/.npm/_logs/2024-04-16T07_41_12_352Z-debug-0.log
**04-16-2024 03:44:23 AM [Build] The command '/bin/sh -c npm run deploy' returned a non-zero code: 1
04-16-2024 03:44:27 AM [AppRunner] Failed to build your application source code. Reason: Failed to execute 'build' command.
04-16-2024 03:44:29 AM [AppRunner] Failed to deploy your application source code.

If I am unable to view this log, is there a tutorial on how I can download and use the the Node 18 Docker that AWS App Runner uses to replicate the failure locally?

I have done this kind of thing with Netlify which I'm migrating away from but couldn't quite see how this was possible with AWS App Runner - from the looks of it, it is not?

https://github.com/aws/apprunner-roadmap/issues/89

Ben
asked 13 days ago154 views
1 Answer
0

Some updates:

Updating my build command with verbose logging spat out some more log details (npm run deploy --loglevel verbose) - not sure if this is exactly what would be found in the /root log, but it is providing more information.

04-20-2024 08:53:23 PM [Build] npm notice 
04-20-2024 08:53:23 PM [Build] npm notice New minor version of npm available! 10.2.4 -> 10.5.2
04-20-2024 08:53:23 PM [Build] npm notice Changelog: <https://github.com/npm/cli/releases/tag/v10.5.2>
04-20-2024 08:53:23 PM [Build] npm notice Run `npm install -g npm@10.5.2` to update!
04-20-2024 08:53:23 PM [Build] npm notice 
04-20-2024 08:53:23 PM [Build] npm verb stack Error: command failed
04-20-2024 08:53:23 PM [Build] npm verb stack     at ChildProcess.<anonymous> (/opt/node-v18.19.1/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:53:27)
04-20-2024 08:53:23 PM [Build] npm verb stack     at ChildProcess.emit (node:events:517:28)
04-20-2024 08:53:23 PM [Build] npm verb stack     at maybeClose (node:internal/child_process:1098:16)
04-20-2024 08:53:23 PM [Build] npm verb stack     at ChildProcess._handle.onexit (node:internal/child_process:303:5)
04-20-2024 08:53:23 PM [Build] npm verb cwd /app
04-20-2024 08:53:23 PM [Build] npm verb Linux 4.14.291-218.527.amzn2.x86_64
04-20-2024 08:53:23 PM [Build] npm verb node v18.19.1
04-20-2024 08:53:23 PM [Build] npm verb npm  v10.2.4
04-20-2024 08:53:23 PM [Build] npm ERR! path /app
04-20-2024 08:53:23 PM [Build] npm ERR! command failed
04-20-2024 08:53:23 PM [Build] npm ERR! signal SIGKILL
04-20-2024 08:53:23 PM [Build] npm ERR! command sh -c npm install && npm run build
04-20-2024 08:53:23 PM [Build] npm verb exit 1
04-20-2024 08:53:23 PM [Build] npm verb code 1
Ben
answered 13 days 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.

Guidelines for Answering Questions