while deploying my nextjs project with sentry on aws amplify build getting failed

0

JavaScript Framework

Next.js

Description

I am using nextjs 11.1.3 when I added sentry error tracking to my next js project when i build and run it locally it works fine but when i deploy my sentry nextjs project on aws amplyfy my build getting failed with following error,

I am using nextjs 11.1.3 when I added sentry error tracking to my next js project when i build and run it locally it works fine but when i deploy my sentry nextjs project on aws amplyfy my build getting failed with following error,
'> Build error occurred\n' +
                                  'Error: spawn ENOMEM\n' +
                                  '    at ChildProcess.spawn (node:internal/child_process:420:11)\n' +
                                  '    at spawn (node:child_process:733:9)\n' +
                                  '    at fork (node:child_process:169:10)\n' +
                                  '    at ChildProcessWorker.initialize (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/node_modules/jest-worker/build/workers/ChildProcessWorker.js:141:45)\n' +
                                  '    at new ChildProcessWorker (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/node_modules/jest-worker/build/workers/ChildProcessWorker.js:132:10)\n' +
                                  '    at WorkerPool.createWorker (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/node_modules/jest-worker/build/WorkerPool.js:44:12)\n' +
                                  '    at new BaseWorkerPool (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/node_modules/jest-worker/build/base/BaseWorkerPool.js:135:27)\n' +
                                  '    at new WorkerPool (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/node_modules/jest-worker/build/WorkerPool.js:30:1)\n' +
                                  '    at new Worker (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/node_modules/jest-worker/build/index.js:167:26)\n' +
                                  '    at createWorker (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/dist/lib/worker.js:15:28)\n' +
                                  '    at new Worker1 (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/dist/lib/worker.js:21:9)\n' +
                                  '    at /codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/dist/build/index.js:432:31\n' +
                                  '    at async Span.traceAsyncFn (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/dist/telemetry/trace/trace.js:60:20)\n' +
                                  '    at async Object.build [as default] (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/dist/build/index.js:77:25) {\n' +
                                  '  errno: -12,\n' +
                                  "  code: 'ENOMEM',\n" +
                                  "  syscall: 'spawn'\n" +
                                  '}',
                                  failed: true,
                                  timedOut: false,
                                  isCanceled: false,
                                  killed: false
                                  }
                                  
2023-08-10T16:47:33.927Z [ERROR]: [?25h
                                  300s › darxjey0xrl5c › Error: Command failed with exit code 1: node_modules/.bin/next build

To Reproduce

Below is my aws amplify build logs '> Build error occurred\n' + 'Error: spawn ENOMEM\n' + ' at ChildProcess.spawn (node:internal/child_process:420:11)\n' + ' at spawn (node:child_process:733:9)\n' + ' at fork (node:child_process:169:10)\n' + ' at ChildProcessWorker.initialize (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/node_modules/jest-worker/build/workers/ChildProcessWorker.js:141:45)\n' + ' at new ChildProcessWorker (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/node_modules/jest-worker/build/workers/ChildProcessWorker.js:132:10)\n' + ' at WorkerPool.createWorker (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/node_modules/jest-worker/build/WorkerPool.js:44:12)\n' + ' at new BaseWorkerPool (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/node_modules/jest-worker/build/base/BaseWorkerPool.js:135:27)\n' + ' at new WorkerPool (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/node_modules/jest-worker/build/WorkerPool.js:30:1)\n' + ' at new Worker (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/node_modules/jest-worker/build/index.js:167:26)\n' + ' at createWorker (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/dist/lib/worker.js:15:28)\n' + ' at new Worker1 (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/dist/lib/worker.js:21:9)\n' + ' at /codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/dist/build/index.js:432:31\n' + ' at async Span.traceAsyncFn (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/dist/telemetry/trace/trace.js:60:20)\n' + ' at async Object.build [as default] (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/dist/build/index.js:77:25) {\n' + ' errno: -12,\n' + " code: 'ENOMEM',\n" + " syscall: 'spawn'\n" + '}', failed: true, timedOut: false, isCanceled: false, killed: false }  2023-08-10T16:47:33.927Z [ERROR]: [?25h 300s › darxjey0xrl5c › Error: Command failed with exit code 1: node_modules/.bin/next build

Expected behavior

my nextjs project which contains sentry error tracking build should not fail.

Code Snippet

// Put your code below this line.
**next.config.js File**
```javascript
const { withSentryConfig } = require("@sentry/nextjs");
const nextConfig = {
  ...nextConfigurations
  productionBrowserSourceMaps: true,
  sentry:{
    widenClientFileUpload: true,
    transpileClientSDK: true,
    hideSourceMaps: true,
    disableLogger: true,
  }
};

const sentryWebpackPluginOptions = {
  org: process.env.NEXT_PUBLIC_SENTRY_ORG_NAME,
  project: process.env.NEXT_PUBLIC_SENTRY_PROJECT_NAME,
  authToken: process.env.NEXT_PUBLIC_SENTRY_AUTH_TOKEN,
  sourceMapFilename: '[name].[hash].js.map',
  silent: true,
};

module.exports = withSentryConfig(nextConfig, sentryWebpackPluginOptions);

sentry.client.config.js


import * as Sentry from "@sentry/nextjs";
import { ContextLines } from "@sentry/integrations";

Sentry.init({
  dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
  tracesSampleRate: 0.2,
  replaysSessionSampleRate: 0.1,
  replaysOnErrorSampleRate: 0.1,
  integrations: [
    new Sentry.Replay(),
    new ContextLines({
      frameContextLines: 7,
    }),
  ],
});

app.js

 Sentry.init({
        dsn: process.env.NEXT_PUBLIC_SENTRY_DSN,
        integrations: [
          new BrowserTracing()
        ],
        tracesSampleRate: 0.2,
      });

So this setup works well for me in locally when i build locally sourcemap getting uploaded to my sentry dashboard and also i get proper stack starce but when i try to deploy on aws amplify my build is failing and getting below error

'> Build error occurred\n' +
                                  'Error: spawn ENOMEM\n' +
                                  '    at ChildProcess.spawn (node:internal/child_process:420:11)\n' +
                                  '    at spawn (node:child_process:733:9)\n' +
                                  '    at fork (node:child_process:169:10)\n' +
                                  '    at ChildProcessWorker.initialize (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/node_modules/jest-worker/build/workers/ChildProcessWorker.js:141:45)\n' +
                                  '    at new ChildProcessWorker (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/node_modules/jest-worker/build/workers/ChildProcessWorker.js:132:10)\n' +
                                  '    at WorkerPool.createWorker (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/node_modules/jest-worker/build/WorkerPool.js:44:12)\n' +
                                  '    at new BaseWorkerPool (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/node_modules/jest-worker/build/base/BaseWorkerPool.js:135:27)\n' +
                                  '    at new WorkerPool (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/node_modules/jest-worker/build/WorkerPool.js:30:1)\n' +
                                  '    at new Worker (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/node_modules/jest-worker/build/index.js:167:26)\n' +
                                  '    at createWorker (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/dist/lib/worker.js:15:28)\n' +
                                  '    at new Worker1 (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/dist/lib/worker.js:21:9)\n' +
                                  '    at /codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/dist/build/index.js:432:31\n' +
                                  '    at async Span.traceAsyncFn (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/dist/telemetry/trace/trace.js:60:20)\n' +
                                  '    at async Object.build [as default] (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/dist/build/index.js:77:25) {\n' +
                                  '  errno: -12,\n' +
                                  "  code: 'ENOMEM',\n" +
                                  "  syscall: 'spawn'\n" +
                                  '}',
                                  failed: true,
                                  timedOut: false,
                                  isCanceled: false,
                                  killed: false
                                  }
                                  
2023-08-10T16:47:33.927Z [ERROR]: [?25h
                                  300s › darxjey0xrl5c › Error: Command failed with exit code 1: node_modules/.bin/next build

I am not getting why I am getting this problem only when i deploy it on aws amplify locally everything working fine.



// Put your logs below this line

Build error occurred Error: spawn ENOMEM at ChildProcess.spawn (node:internal/child_process:420:11) at spawn (node:child_process:733:9) at fork (node:child_process:169:10) at ChildProcessWorker.initialize (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/node_modules/jest-worker/build/workers/ChildProcessWorker.js:141:45) at new ChildProcessWorker (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/node_modules/jest-worker/build/workers/ChildProcessWorker.js:132:10) at WorkerPool.createWorker (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/node_modules/jest-worker/build/WorkerPool.js:44:12) at new BaseWorkerPool (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/node_modules/jest-worker/build/base/BaseWorkerPool.js:135:27) at new WorkerPool (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/node_modules/jest-worker/build/WorkerPool.js:30:1) at new Worker (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/node_modules/jest-worker/build/index.js:167:26) at createWorker (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/dist/lib/worker.js:15:28) at new Worker1 (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/dist/lib/worker.js:21:9) at /codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/dist/build/index.js:432:31 at async Span.traceAsyncFn (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/dist/telemetry/trace/trace.js:60:20) at async Object.build [as default] (/codebuild/output/src489982623/src/Expertia-nextjs/node_modules/next/dist/build/index.js:77:25) { errno: -12, code: 'ENOMEM', syscall: 'spawn' } info - Using webpack 5. Reason: Enabled by default https://nextjs.org/docs/messages/webpack5 info - Checking validity of types... info - Creating an optimized production build... info - Using external babel configuration from /codebuild/output/src489982623/src/Expertia-nextjs/.babelrc info - Collecting page data... at makeError (/root/.//node_modules/execa/lib/error.js:60:11) at handlePromise (/root/.//node_modules/e

1 Antwort
0

Hello there,

The team is made aware of of the Issue and all the update will be shared here
https://github.com/aws-amplify/amplify-hosting/issues/3640

AWS
Thato_B
beantwortet vor 9 Monaten

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen