mirror of
https://github.com/hoppscotch/hoppscotch.git
synced 2026-04-25 16:55:59 +03:00
[GH-ISSUE #4479] [bug] JwtStrategy requires a secret or key #1641
Labels
No labels
CodeDay
a11y
browser limited
bug
bug fix
cli
core
critical
design
desktop
discussion
docker
documentation
duplicate
enterprise
feature
feature
fosshack
future
good first issue
hacktoberfest
help wanted
i18n
invalid
major
minor
need information
need testing
not applicable to hoppscotch
not reproducible
pull-request
question
refactor
resolved
sandbox
self-host
spam
stale
testmu
wip
wont fix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hoppscotch#1641
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @crocofied on GitHub (Oct 25, 2024).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/4479
Is there an existing issue for this?
Current behavior
When I use the following .env:
And this docker compose:
I get this error on startup:
Backend Server | [Nest] 37 - 10/25/2024, 5:41:26 PM ERROR ;5;3m[ExceptionHandler] JwtStrategy requires a secret or key Backend Server | TypeError: JwtStrategy requires a secret or key Backend Server | at new JwtStrategy (/dist/backend/node_modules/.pnpm/passport-jwt@4.0.1/node_modules/passport-jwt/lib/strategy.js:45:15) Backend Server | at new MixinStrategy (/dist/backend/node_modules/.pnpm/@nestjs+passport@10.0.2_@nestjs+common@10.2.7_class-transformer@0.5.1_class-validator@0.14.1__owspyaltb3hygw66etzcv5nnwq/node_modules/@nestjs/passport/dist/passport/passport.strategy.js:32:13) Backend Server | at new JwtStrategy (/dist/backend/dist/auth/strategies/jwt.strategy.js:22:9) Backend Server | at Injector.instantiateClass (/dist/backend/node_modules/.pnpm/@nestjs+core@10.2.7_@nestjs+common@10.2.7_class-transformer@0.5.1_class-validator@0.14.1_refl_i5vxtddbnp5qhu6jmywguprp3e/node_modules/@nestjs/core/injector/injector.js:365:19) Backend Server | at callback (/dist/backend/node_modules/.pnpm/@nestjs+core@10.2.7_@nestjs+common@10.2.7_class-transformer@0.5.1_class-validator@0.14.1_refl_i5vxtddbnp5qhu6jmywguprp3e/node_modules/@nestjs/core/injector/injector.js:65:45) Backend Server | at async Injector.resolveConstructorParams (/dist/backend/node_modules/.pnpm/@nestjs+core@10.2.7_@nestjs+common@10.2.7_class-transformer@0.5.1_class-validator@0.14.1_refl_i5vxtddbnp5qhu6jmywguprp3e/node_modules/@nestjs/core/injector/injector.js:144:24) Backend Server | at async Injector.loadInstance (/dist/backend/node_modules/.pnpm/@nestjs+core@10.2.7_@nestjs+common@10.2.7_class-transformer@0.5.1_class-validator@0.14.1_refl_i5vxtddbnp5qhu6jmywguprp3e/node_modules/@nestjs/core/injector/injector.js:70:13) Backend Server | at async Injector.loadProvider (/dist/backend/node_modules/.pnpm/@nestjs+core@10.2.7_@nestjs+common@10.2.7_class-transformer@0.5.1_class-validator@0.14.1_refl_i5vxtddbnp5qhu6jmywguprp3e/node_modules/@nestjs/core/injector/injector.js:97:9) Backend Server | at async /dist/backend/node_modules/.pnpm/@nestjs+core@10.2.7_@nestjs+common@10.2.7_class-transformer@0.5.1_class-validator@0.14.1_refl_i5vxtddbnp5qhu6jmywguprp3e/node_modules/@nestjs/core/injector/instance-loader.js:56:13 Backend Server | at async Promise.all (index 4) Exiting process because Backend Server exited with code 1Steps to reproduce
Environment
Production
Version
Self-hosted
@mirarifhasan commented on GitHub (Oct 29, 2024):
Hi @crocofied
It looks like the container might not be able to read the
JWT_SECRETfrom your .env file. Could you double-check by running these commands?This should help confirm if the variable is being picked up correctly. Let me know how it goes.
@Leon-Luu commented on GitHub (Nov 8, 2024):
This issue doesn't needs to be executed on docker to reproduce. We are seeing same issue on local running:
Error:
[Nest] 39480 - 2024-11-08 09:34:57 ERROR [ExceptionHandler] JwtStrategy requires a secret or key
[Nest] 39480 - 2024-11-08 09:34:57 LOG [InstanceLoader] ConfigModule dependencies initialized +7ms
[Nest] 39480 - 2024-11-08 09:34:57 ERROR [ExceptionHandler] JwtStrategy requires a secret or key
[Nest] 39480 - 2024-11-08 09:34:57 ERROR [ExceptionHandler] JwtStrategy requires a secret or key
TypeError: JwtStrategy requires a secret or key
TypeError: JwtStrategy requires a secret or key
at new JwtStrategy (F:\hoppscotch\node_modules.pnpm\passport-jwt@4.0.1\node_modules\passport-jwt\lib\strategy.js:45:15)
at new MixinStrategy (F:\hoppscotch\node_modules.pnpm@nestjs+passport@10.0.3_@nestjs+common@10.4.4_class-transformer@0.5.1_class-validator@0.14.1__del4tn2jophjss3wlonykp5veu\node_modules@nestjs\passport\dist\passport\passport.strategy.js:32:13)
at new JwtStrategy (F:\hoppscotch\packages\hoppscotch-backend\dist\auth\strategies\jwt.strategy.js:22:9)
@mirarifhasan commented on GitHub (Nov 29, 2024):
Hi @crocofied
If you’re still experiencing the issue, please don’t hesitate to let us know—we’re here to help! If everything is working fine now, we’ll go ahead and close this issue.
Looking forward to your update!
@mihalcea-bogdan-daniel commented on GitHub (Feb 21, 2025):
This is still an issue. Running
pnpm start:devin package/hoppscotch-backend@mihalcea-bogdan-daniel commented on GitHub (Feb 21, 2025):
@Leon-Luu
In the app.module.ts at line 39 add the following:
envFilePath: '../../.env.example'This will load the correct environment file.
@ferdousulhaque commented on GitHub (May 18, 2025):
Need help on how to resolve this over the Kubernetes deployment file. Here is my config:
while deployment, I am only using the image
@syorito-hatsuki commented on GitHub (Jul 22, 2025):
Ye. That not answer how fix it on K8S
@blevkovych commented on GitHub (Jul 30, 2025):
I was just following the installation process and see the same issue in logs for backend container.