hoppscotch / hoppscotch

Open source API development ecosystem - https://hoppscotch.io (open-source alternative to Postman, Insomnia)
https://hoppscotch.io
MIT License
65.82k stars 4.58k forks source link

[bug]: Google login issue (ERROR [ExceptionsHandler] "expiresIn") #3528

Open J0Pstr opened 1 year ago

J0Pstr commented 1 year ago

Is there an existing issue for this?

Current behavior

I'm trying to login with my Google account and the following error 500 occurs when requesting the backend callback URL:

> hoppscotch-backend@2023.8.3-1 start:prod /usr/src/app
> node dist/main

Running in production: true
Port: 3170
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [NestFactory] Starting Nest application...
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [InstanceLoader] PubSubModule dependencies initialized +56ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [InstanceLoader] PrismaModule dependencies initialized +0ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [InstanceLoader] MailerModule dependencies initialized +0ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [InstanceLoader] PassportModule dependencies initialized +1ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [InstanceLoader] ThrottlerModule dependencies initialized +0ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [InstanceLoader] JwtModule dependencies initialized +1ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [InstanceLoader] MailerCoreModule dependencies initialized +0ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [InstanceLoader] MailerModule dependencies initialized +4ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [InstanceLoader] AppModule dependencies initialized +0ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [InstanceLoader] UserModule dependencies initialized +7ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [InstanceLoader] UserSettingsModule dependencies initialized +1ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [InstanceLoader] UserEnvironmentsModule dependencies initialized +0ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [InstanceLoader] UserHistoryModule dependencies initialized +0ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [InstanceLoader] UserCollectionModule dependencies initialized +0ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [InstanceLoader] GraphQLSchemaBuilderModule dependencies initialized +0ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [InstanceLoader] TeamEnvironmentsModule dependencies initialized +1ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [InstanceLoader] TeamCollectionModule dependencies initialized +0ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [InstanceLoader] UserRequestModule dependencies initialized +5ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [InstanceLoader] TeamModule dependencies initialized +0ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [InstanceLoader] ShortcodeModule dependencies initialized +1ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [InstanceLoader] TeamInvitationModule dependencies initialized +1ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [InstanceLoader] TeamRequestModule dependencies initialized +0ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [InstanceLoader] AuthModule dependencies initialized +1ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [InstanceLoader] GraphQLModule dependencies initialized +0ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [InstanceLoader] AdminModule dependencies initialized +0ms
Thu, 09 Nov 2023 17:11:58 GMT express-session deprecated undefined resave option; provide resave option at dist/main.js:16:13
Thu, 09 Nov 2023 17:11:58 GMT express-session deprecated undefined saveUninitialized option; provide saveUninitialized option at dist/main.js:16:13
Enabling CORS with production settings
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [RoutesResolver] AppController {/ping}: +19ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [RouterExplorer] Mapped {/ping, GET} route +3ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [RoutesResolver] AuthController {/auth} (version: 1): +1ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [RouterExplorer] Mapped {/auth/signin, POST} (version: 1) route +1ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [RouterExplorer] Mapped {/auth/verify, POST} (version: 1) route +1ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [RouterExplorer] Mapped {/auth/refresh, GET} (version: 1) route +0ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [RouterExplorer] Mapped {/auth/google, GET} (version: 1) route +1ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [RouterExplorer] Mapped {/auth/google/callback, GET} (version: 1) route +1ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [RouterExplorer] Mapped {/auth/github, GET} (version: 1) route +0ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [RouterExplorer] Mapped {/auth/github/callback, GET} (version: 1) route +1ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [RouterExplorer] Mapped {/auth/microsoft, GET} (version: 1) route +0ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [RouterExplorer] Mapped {/auth/microsoft/callback, GET} (version: 1) route +1ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [RouterExplorer] Mapped {/auth/logout, GET} (version: 1) route +1ms
[Nest] 19  - 11/09/2023, 5:11:58 PM     LOG [RouterExplorer] Mapped {/auth/verify/admin, GET} (version: 1) route +0ms
Initialize PubSub
[Nest] 19  - 11/09/2023, 5:11:59 PM     LOG [GraphQLModule] Mapped {/graphql, POST} route +477ms
[Nest] 19  - 11/09/2023, 5:11:59 PM     LOG [NestApplication] Nest application successfully started +4ms
Query Complexity: 3
Query Complexity: 17
Query Complexity: 7
Query Complexity: 4
Query Complexity: 3
[Nest] 19  - 11/09/2023, 5:15:09 PM   ERROR [ExceptionsHandler] "expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60
Error: "expiresIn" should be a number of seconds or string representing a timespan eg: "1d", "20h", 60
    at module.exports [as sign] (/usr/src/app/node_modules/.pnpm/jsonwebtoken@9.0.0/node_modules/jsonwebtoken/sign.js:207:22)
    at JwtService.sign (/usr/src/app/node_modules/.pnpm/@nestjs+jwt@10.1.1_@nestjs+common@10.2.7/node_modules/@nestjs/jwt/dist/jwt.service.js:35:20)
    at AuthService.generateAuthTokens (/usr/src/app/dist/auth/auth.service.js:92:49)
    at async AuthController.googleAuthRedirect (/usr/src/app/dist/auth/auth.controller.js:58:28)
    at async /usr/src/app/node_modules/.pnpm/@nestjs+core@10.2.7_@nestjs+common@10.2.7_@nestjs+platform-express@10.2.7_reflect-metadata@0.1.13_rxjs@7.8.1/node_modules/@nestjs/core/router/router-execution-context.js:46:28
    at async /usr/src/app/node_modules/.pnpm/@nestjs+core@10.2.7_@nestjs+common@10.2.7_@nestjs+platform-express@10.2.7_reflect-metadata@0.1.13_rxjs@7.8.1/node_modules/@nestjs/core/router/router-proxy.js:9:17

Steps to reproduce

Tried with the following backend images (in each case frontend/admin images were set accordingly):

I'm using a PostgreSQL v13 regarding this issue #3378 on a GKE integration.

Environment

Production

Version

Self-hosted

aduarterengifo commented 10 months ago

running into the same issue self-hosting with

ENABLE_SUBPATH_BASED_ACCESS=true

aduarterengifo commented 10 months ago

Actually is a problem in the env file.

REFRESH_TOKEN_VALIDITY=604800000 # Default validity is 7 days (604800000 ms) in ms

the comment is not being ignored.

liyasthomas commented 10 months ago

@balub can you verify the comments in .env are ignored?