Skip to content

🐛 Bug Report: Can't start with docker compose : Missing secret key. Set the NOVU_SECRET_KEY environment variable #7462

@fayak

Description

@fayak

📜 Description

I'm following instructions from https://docs.novu.co/community/self-hosting-novu/deploy-with-docker#quick-start but I get this error:

api      | [Nest] 32  - 01/08/2025, 2:50:35 PM     LOG BOOTSTRAPPED NEST APPLICATION
api      | [Nest] 32  - 01/08/2025, 2:50:35 PM     LOG [FeatureFlagsService] Feature Flags service has been successfully initialized
api      | [Nest] 32  - 01/08/2025, 2:50:35 PM     LOG [InstanceLoader] PassportModule dependencies initialized +0ms
api      | [Nest] 32  - 01/08/2025, 2:50:35 PM     LOG [InstanceLoader] OpenTelemetryModule dependencies initialized +0ms
api      | [Nest] 32  - 01/08/2025, 2:50:35 PM     LOG [InstanceLoader] Gt dependencies initialized +0ms
api      | [Nest] 32  - 01/08/2025, 2:50:35 PM     LOG [InstanceLoader] JwtModule dependencies initialized +0ms
api      | [Nest] 32  - 01/08/2025, 2:50:35 PM     LOG [InstanceLoader] HttpModule dependencies initialized +0ms
api      | [Nest] 32  - 01/08/2025, 2:50:35 PM     LOG [InstanceLoader] ThrottlerModule dependencies initialized +0ms
api      | [Nest] 32  - 01/08/2025, 2:50:35 PM     LOG [InstanceLoader] ProfilingModule dependencies initialized +0ms
api      | [Nest] 32  - 01/08/2025, 2:50:35 PM     LOG [InstanceLoader] TracingModule dependencies initialized +0ms
api      | [Nest] 32  - 01/08/2025, 2:50:35 PM     LOG [InstanceLoader] OpenTelemetryCoreModule dependencies initialized +0ms
api      | [Nest] 32  - 01/08/2025, 2:50:35 PM   ERROR [ExceptionHandler] Missing secret key. Set the `NOVU_SECRET_KEY` environment variable or pass `secretKey` to the client options.
api      | Error: Missing secret key. Set the `NOVU_SECRET_KEY` environment variable or pass `secretKey` to the client options.
api      |     at xn (/usr/src/app/packages/framework/dist/cjs/servers/nest.cjs:1:12813)
api      |     at new At (/usr/src/app/packages/framework/dist/cjs/servers/nest.cjs:95:3577)
api      |     at new Ge (/usr/src/app/packages/framework/dist/cjs/servers/nest.cjs:505:16518)
api      |     at Injector.instantiateClass (/usr/src/app/node_modules/.pnpm/@nestjs+core@10.4.1_@nestjs+common@10.4.1_class-transformer@0.5.1_class-validator@0.14.1_refl_arvk5acfrwkf4aznfcoflsyj4a/node_modules/@nestjs/core/injector/injector.js:365:19)
api      |     at callback (/usr/src/app/node_modules/.pnpm/@nestjs+core@10.4.1_@nestjs+common@10.4.1_class-transformer@0.5.1_class-validator@0.14.1_refl_arvk5acfrwkf4aznfcoflsyj4a/node_modules/@nestjs/core/injector/injector.js:65:45)
api      |     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
api      |     at async Injector.resolveConstructorParams (/usr/src/app/node_modules/.pnpm/@nestjs+core@10.4.1_@nestjs+common@10.4.1_class-transformer@0.5.1_class-validator@0.14.1_refl_arvk5acfrwkf4aznfcoflsyj4a/node_modules/@nestjs/core/injector/injector.js:144:24)
api      |     at async Injector.loadInstance (/usr/src/app/node_modules/.pnpm/@nestjs+core@10.4.1_@nestjs+common@10.4.1_class-transformer@0.5.1_class-validator@0.14.1_refl_arvk5acfrwkf4aznfcoflsyj4a/node_modules/@nestjs/core/injector/injector.js:70:13)
api      |     at async Injector.loadProvider (/usr/src/app/node_modules/.pnpm/@nestjs+core@10.4.1_@nestjs+common@10.4.1_class-transformer@0.5.1_class-validator@0.14.1_refl_arvk5acfrwkf4aznfcoflsyj4a/node_modules/@nestjs/core/injector/injector.js:97:9)
api      |     at async /usr/src/app/node_modules/.pnpm/@nestjs+core@10.4.1_@nestjs+common@10.4.1_class-transformer@0.5.1_class-validator@0.14.1_refl_arvk5acfrwkf4aznfcoflsyj4a/node_modules/@nestjs/core/injector/instance-loader.js:56:13
api      | 2025-01-08T14:50:35: PM2 log: App [main:0] exited with code [1] via signal [SIGINT]
api      | 2025-01-08T14:50:35: PM2 log: App [main:0] starting in -fork mode-
api      | 2025-01-08T14:50:35: PM2 log: App [main:0] online
api      | New Relic for Node.js was unable to bootstrap itself due to an error:
api      | Error: New Relic requires that you name this application!
api      | Set app_name in your newrelic.js or newrelic.cjs file or set environment variable
api      | NEW_RELIC_APP_NAME. Not starting!
api      |     at createAgent (/usr/src/app/node_modules/.pnpm/newrelic@9.15.0/node_modules/newrelic/index.js:140:11)
api      |     at initialize (/usr/src/app/node_modules/.pnpm/newrelic@9.15.0/node_modules/newrelic/index.js:81:15)
api      |     at Object.<anonymous> (/usr/src/app/node_modules/.pnpm/newrelic@9.15.0/node_modules/newrelic/index.js:36:3)
api      |     at Module._compile (node:internal/modules/cjs/loader:1469:14)
api      |     at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
api      |     at Module.load (node:internal/modules/cjs/loader:1288:32)
api      |     at Module._load (node:internal/modules/cjs/loader:1104:12)
api      |     at Module.require (node:internal/modules/cjs/loader:1311:19)
api      |     at Hook._require.Module.require (/usr/local/lib/node_modules/pm2/node_modules/require-in-the-middle/index.js:101:39)
api      |     at require (node:internal/modules/helpers:179:18)
api      | Environment: dev
api      | Platform: Docker
api      | Tenant: OS
api      | Log Level Chosen: info
api      | { error: 50, warn: 40, info: 30, verbose: 20, debug: 10 }
api      | Selected Log Transport None { error: 50, warn: 40, info: 30, verbose: 20, debug: 10 }

👟 Reproduction steps

Follow the instructions from https://docs.novu.co/community/self-hosting-novu/deploy-with-docker#quick-start

Here are the .env diffs:


diff .env .env.example 
4c4
< JWT_SECRET=toto
---
> JWT_SECRET=your-secret
8,9c8
< STORE_ENCRYPTION_KEY=abcdabcdabcdabcdabcdabcdabcdabcd
< NOVU_SECRET_KEY=abcdabcdabcdabcdabcdabcdabcdabcd
---
> STORE_ENCRYPTION_KEY=<ENCRYPTION_KEY_MUST_BE_32_LONG>
16c15
< NODE_ENV=dev
---
> NODE_ENV=local
34,38c33,37
< S3_LOCAL_STACK=https://example.com
< S3_BUCKET_NAME=test-novu
< S3_REGION=empty  # Btw I shouldn't have to set this up, I don't have an S3-region in my S3 provider
< AWS_ACCESS_KEY_ID=something
< AWS_SECRET_ACCESS_KEY=something-else
---
> S3_LOCAL_STACK=$HOST_NAME:4566
> S3_BUCKET_NAME=novu-local
> S3_REGION=us-east-1
> AWS_ACCESS_KEY_ID=test
> AWS_SECRET_ACCESS_KEY=test

👍 Expected behavior

Following instructions from the documentation should work.
I even set the NOVU_SECRET_KEY in the .env, with no success

👎 Actual Behavior with Screenshots

API not working and throwing the error share above

Novu version

commit 3abfb01 | version 2.1.0

npm version

No response

node version

No response

📃 Provide any additional context for the Bug.

No response

👀 Have you spent some time to check if this bug has been raised before?

  • I checked and didn't find a similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to submit PR?

None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions