Hello,
We are using next.js for our builder website. However recently by running next.js command to create production optimized build “next builds/npm run build” we started getting the following errors:
/opt/avengers/node_modules/@builder.io/sdk/dist/index.cjs.js:2283
throw new Error("Fetching content failed, expected apiKey to be defined instead got: ".concat(this.apiKey));
^
Error: Fetching content failed, expected apiKey to be defined instead got: null
at Builder.flushGetContentQueue (/opt/avengers/node_modules/@builder.io/sdk/dist/index.cjs.js:2283:19)
at Timeout._onTimeout (/opt/avengers/node_modules/@builder.io/sdk/dist/index.cjs.js:2224:27)
at listOnTimeout (node:internal/timers:581:17)
at process.processTimers (node:internal/timers:519:7)
Node.js v20.16.0
/opt/avengers/node_modules/@builder.io/sdk/dist/index.cjs.js:2283
throw new Error("Fetching content failed, expected apiKey to be defined instead got: ".concat(this.apiKey));
^
Error: Fetching content failed, expected apiKey to be defined instead got: null
at Builder.flushGetContentQueue (/opt/avengers/node_modules/@builder.io/sdk/dist/index.cjs.js:2283:19)
at Timeout._onTimeout (/opt/avengers/node_modules/@builder.io/sdk/dist/index.cjs.js:2224:27)
at listOnTimeout (node:internal/timers:581:17)
at process.processTimers (node:internal/timers:519:7)
Node.js v20.16.0
⨯ Static worker exited with code: 1 and signal: null
⨯ Static worker exited with code: 1 and signal: null
/opt/avengers/node_modules/@builder.io/sdk/dist/index.cjs.js:2283
throw new Error("Fetching content failed, expected apiKey to be defined instead got: ".concat(this.apiKey));
^
Error: Fetching content failed, expected apiKey to be defined instead got: null
at Builder.flushGetContentQueue (/opt/avengers/node_modules/@builder.io/sdk/dist/index.cjs.js:2283:19)
at Timeout._onTimeout (/opt/avengers/node_modules/@builder.io/sdk/dist/index.cjs.js:2224:27)
at listOnTimeout (node:internal/timers:581:17)
at process.processTimers (node:internal/timers:519:7)
Node.js v20.16.0
/opt/avengers/node_modules/@builder.io/sdk/dist/index.cjs.js:2283
throw new Error("Fetching content failed, expected apiKey to be defined instead got: ".concat(this.apiKey));
^
Error: Fetching content failed, expected apiKey to be defined instead got: null
at Builder.flushGetContentQueue (/opt/avengers/node_modules/@builder.io/sdk/dist/index.cjs.js:2283:19)
at Timeout._onTimeout (/opt/avengers/node_modules/@builder.io/sdk/dist/index.cjs.js:2224:27)
at listOnTimeout (node:internal/timers:581:17)
at process.processTimers (node:internal/timers:519:7)
Node.js v20.16.0
/opt/avengers/node_modules/@builder.io/sdk/dist/index.cjs.js:2283
throw new Error("Fetching content failed, expected apiKey to be defined instead got: ".concat(this.apiKey));
^
Error: Fetching content failed, expected apiKey to be defined instead got: null
at Builder.flushGetContentQueue (/opt/avengers/node_modules/@builder.io/sdk/dist/index.cjs.js:2283:19)
at Timeout._onTimeout (/opt/avengers/node_modules/@builder.io/sdk/dist/index.cjs.js:2224:27)
at listOnTimeout (node:internal/timers:581:17)
at process.processTimers (node:internal/timers:519:7)
Node.js v20.16.0
/opt/avengers/node_modules/@builder.io/sdk/dist/index.cjs.js:2283
throw new Error("Fetching content failed, expected apiKey to be defined instead got: ".concat(this.apiKey));
^
Error: Fetching content failed, expected apiKey to be defined instead got: null
at Builder.flushGetContentQueue (/opt/avengers/node_modules/@builder.io/sdk/dist/index.cjs.js:2283:19)
at Timeout._onTimeout (/opt/avengers/node_modules/@builder.io/sdk/dist/index.cjs.js:2224:27)
at listOnTimeout (node:internal/timers:581:17)
at process.processTimers (node:internal/timers:519:7)
Node.js v20.16.0
/opt/avengers/node_modules/@builder.io/sdk/dist/index.cjs.js:2283
throw new Error("Fetching content failed, expected apiKey to be defined instead got: ".concat(this.apiKey));
^
Error: Fetching content failed, expected apiKey to be defined instead got: null
at Builder.flushGetContentQueue (/opt/avengers/node_modules/@builder.io/sdk/dist/index.cjs.js:2283:19)
at Timeout._onTimeout (/opt/avengers/node_modules/@builder.io/sdk/dist/index.cjs.js:2224:27)
at listOnTimeout (node:internal/timers:581:17)
at process.processTimers (node:internal/timers:519:7)
Node.js v20.16.0
/opt/avengers/node_modules/@builder.io/sdk/dist/index.cjs.js:2283
throw new Error("Fetching content failed, expected apiKey to be defined instead got: ".concat(this.apiKey));
^
Error: Fetching content failed, expected apiKey to be defined instead got: null
at Builder.flushGetContentQueue (/opt/avengers/node_modules/@builder.io/sdk/dist/index.cjs.js:2283:19)
at Timeout._onTimeout (/opt/avengers/node_modules/@builder.io/sdk/dist/index.cjs.js:2224:27)
at listOnTimeout (node:internal/timers:581:17)
at process.processTimers (node:internal/timers:519:7)
Node.js v20.16.0
> Build error occurred
Error: Jest worker encountered 4 child process exceptions, exceeding retry limit
at ChildProcessWorker.initialize (/opt/avengers/node_modules/next/dist/compiled/jest-worker/index.js:1:11580)
at ChildProcessWorker._onExit (/opt/avengers/node_modules/next/dist/compiled/jest-worker/index.js:1:12545)
at ChildProcess.emit (node:events:519:28)
at ChildProcess._handle.onexit (node:internal/child_process:294:12) {
type: 'WorkerError'
}
Yes, the key is passed correctly as Environment variable and everywhere get it like:
builder.init(process.env.NEXT_PUBLIC_BUILDER_API_KEY!);
Builder.isStatic = true;
And this is running within a docker build we also pass the key as ARG. We have also tried to debug and run it manually ensuring the key exists both within .env file and as actuall linux env variable.
We just started receiving this error and previously it was not showing. Is it possible something changed on the builder’s side ?
Kind Regards,
Ivan