[GH-ISSUE #3203] [bug]: table public.User does not exist in the current database #1056

Closed
opened 2026-03-16 18:18:33 +03:00 by kerem · 13 comments
Owner

Originally created by @dreamwhite on GitHub (Jul 20, 2023).
Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/3203

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

When I try logging using GitHub (after editing .env file properly), I see in the docker console this error:

hoppscotch-hoppscotch-db-1  | 2023-07-20 22:26:20.333 UTC [38] STATEMENT:  INSERT INTO "public"."User" ("uid","displayName","email","photoURL","isAdmin","createdOn") VALUES ($1,$2,$3,$4,$5,$6) RETURNING "public"."User"."uid"
hoppscotch-backend          | [Nest] 19  - 07/20/2023, 10:26:20 PM   ERROR [ExceptionsHandler]
hoppscotch-backend          | Invalid `this.prisma.user.create()` invocation in
hoppscotch-backend          | /usr/src/app/dist/user/user.service.js:104:52
hoppscotch-backend          |
hoppscotch-backend          |   101 async createUserSSO(accessTokenSSO, refreshTokenSSO, profile) {
hoppscotch-backend          |   102     const userDisplayName = !profile.displayName ? null : profile.displayName;
hoppscotch-backend          |   103     const userPhotoURL = !profile.photos ? null : profile.photos[0].value;
hoppscotch-backend          | → 104     const createdUser = await this.prisma.user.create(
hoppscotch-backend          | The table `public.User` does not exist in the current database.
hoppscotch-backend          | Error:
hoppscotch-backend          | Invalid `this.prisma.user.create()` invocation in
hoppscotch-backend          | /usr/src/app/dist/user/user.service.js:104:52
hoppscotch-backend          |
hoppscotch-backend          |   101 async createUserSSO(accessTokenSSO, refreshTokenSSO, profile) {
hoppscotch-backend          |   102     const userDisplayName = !profile.displayName ? null : profile.displayName;
hoppscotch-backend          |   103     const userPhotoURL = !profile.photos ? null : profile.photos[0].value;
hoppscotch-backend          | → 104     const createdUser = await this.prisma.user.create(
hoppscotch-backend          | The table `public.User` does not exist in the current database.
hoppscotch-backend          |     at RequestHandler.handleRequestError (/usr/src/app/node_modules/.pnpm/@prisma+client@4.8.1_prisma@4.8.1/node_modules/@prisma/client/runtime/index.js:35024:13)
hoppscotch-backend          |     at RequestHandler.handleAndLogRequestError (/usr/src/app/node_modules/.pnpm/@prisma+client@4.8.1_prisma@4.8.1/node_modules/@prisma/client/runtime/index.js:34996:12)
hoppscotch-backend          |     at RequestHandler.request (/usr/src/app/node_modules/.pnpm/@prisma+client@4.8.1_prisma@4.8.1/node_modules/@prisma/client/runtime/index.js:34991:12)
hoppscotch-backend          |     at async PrismaService._request (/usr/src/app/node_modules/.pnpm/@prisma+client@4.8.1_prisma@4.8.1/node_modules/@prisma/client/runtime/index.js:36082:16)
hoppscotch-backend          |     at async UserService.createUserSSO (/usr/src/app/dist/user/user.service.js:104:29)
hoppscotch-backend          |     at async GithubStrategy.validate (/usr/src/app/dist/auth/strategies/github.strategy.js:35:33)

Steps to reproduce

  1. Go to Hoppscotch self-hosted instance (192.168.1.23:3000 for instance)
  2. Click on login, select GitHub
  3. Proceed by connecting my GitHub account
  4. Error in the console appears

Environment

Production

Version

Self-hosted

Originally created by @dreamwhite on GitHub (Jul 20, 2023). Original GitHub issue: https://github.com/hoppscotch/hoppscotch/issues/3203 ### Is there an existing issue for this? - [X] I have searched the existing issues ### Current behavior When I try logging using GitHub (after editing `.env` file properly), I see in the docker console this error: ``` hoppscotch-hoppscotch-db-1 | 2023-07-20 22:26:20.333 UTC [38] STATEMENT: INSERT INTO "public"."User" ("uid","displayName","email","photoURL","isAdmin","createdOn") VALUES ($1,$2,$3,$4,$5,$6) RETURNING "public"."User"."uid" hoppscotch-backend | [Nest] 19 - 07/20/2023, 10:26:20 PM ERROR [ExceptionsHandler] hoppscotch-backend | Invalid `this.prisma.user.create()` invocation in hoppscotch-backend | /usr/src/app/dist/user/user.service.js:104:52 hoppscotch-backend | hoppscotch-backend | 101 async createUserSSO(accessTokenSSO, refreshTokenSSO, profile) { hoppscotch-backend | 102 const userDisplayName = !profile.displayName ? null : profile.displayName; hoppscotch-backend | 103 const userPhotoURL = !profile.photos ? null : profile.photos[0].value; hoppscotch-backend | → 104 const createdUser = await this.prisma.user.create( hoppscotch-backend | The table `public.User` does not exist in the current database. hoppscotch-backend | Error: hoppscotch-backend | Invalid `this.prisma.user.create()` invocation in hoppscotch-backend | /usr/src/app/dist/user/user.service.js:104:52 hoppscotch-backend | hoppscotch-backend | 101 async createUserSSO(accessTokenSSO, refreshTokenSSO, profile) { hoppscotch-backend | 102 const userDisplayName = !profile.displayName ? null : profile.displayName; hoppscotch-backend | 103 const userPhotoURL = !profile.photos ? null : profile.photos[0].value; hoppscotch-backend | → 104 const createdUser = await this.prisma.user.create( hoppscotch-backend | The table `public.User` does not exist in the current database. hoppscotch-backend | at RequestHandler.handleRequestError (/usr/src/app/node_modules/.pnpm/@prisma+client@4.8.1_prisma@4.8.1/node_modules/@prisma/client/runtime/index.js:35024:13) hoppscotch-backend | at RequestHandler.handleAndLogRequestError (/usr/src/app/node_modules/.pnpm/@prisma+client@4.8.1_prisma@4.8.1/node_modules/@prisma/client/runtime/index.js:34996:12) hoppscotch-backend | at RequestHandler.request (/usr/src/app/node_modules/.pnpm/@prisma+client@4.8.1_prisma@4.8.1/node_modules/@prisma/client/runtime/index.js:34991:12) hoppscotch-backend | at async PrismaService._request (/usr/src/app/node_modules/.pnpm/@prisma+client@4.8.1_prisma@4.8.1/node_modules/@prisma/client/runtime/index.js:36082:16) hoppscotch-backend | at async UserService.createUserSSO (/usr/src/app/dist/user/user.service.js:104:29) hoppscotch-backend | at async GithubStrategy.validate (/usr/src/app/dist/auth/strategies/github.strategy.js:35:33) ``` ### Steps to reproduce 1. Go to Hoppscotch self-hosted instance (`192.168.1.23:3000` for instance) 2. Click on login, select GitHub 3. Proceed by connecting my GitHub account 4. Error in the console appears ### Environment Production ### Version Self-hosted
kerem 2026-03-16 18:18:33 +03:00
Author
Owner

@dreamwhite commented on GitHub (Jul 20, 2023):

I wanna point out also, that for whatever reason, once I click on Login with GitHub the browser redirects me on localhost:3170/auth/github/callback despite .env says 192.168.1.23

<!-- gh-comment-id:1644716434 --> @dreamwhite commented on GitHub (Jul 20, 2023): I wanna point out also, that for whatever reason, once I click on `Login with GitHub` the browser redirects me on `localhost:3170/auth/github/callback` despite `.env` says `192.168.1.23`
Author
Owner

@AndrewBastin commented on GitHub (Jul 21, 2023):

@dreamwhite have you ran the migrations as specified on the Self-Hosted documentation ?

See: https://docs.hoppscotch.io/documentation/self-host/install-and-build#installing-dependencies

<!-- gh-comment-id:1645016536 --> @AndrewBastin commented on GitHub (Jul 21, 2023): @dreamwhite have you ran the migrations as specified on the Self-Hosted documentation ? See: https://docs.hoppscotch.io/documentation/self-host/install-and-build#installing-dependencies
Author
Owner

@dreamwhite commented on GitHub (Jul 21, 2023):

Good morning, yes I did. I wanna remind that I'm using a docker setup so essentially the steps I did were:

  • git clone repo
  • edit .env.example and save it as .env (mainly added GitHub OAuth credentials)
  • docker compose build
  • docker-compose up hoppscotch-db
  • migrate using docker exec -it hoppscotch-db bash and pnpm exec prisma migrate deploy
  • run docker compose up

It seems I had old cached images and after rebuilding from scratch I don’t have anymore the issue of the table.

Now the problem seems to be another: when I try to login using my GitHub OAuth credentials it doesn’t actually login on my Hoppscotch instance but rather keeps showing me the Login button on the top right corner

I tested also the smtp but despite the correct credentials, it still fails sending the email (this is a separate issue i’ll take care of later. my goal now is to fix GH authentication)

<!-- gh-comment-id:1645162921 --> @dreamwhite commented on GitHub (Jul 21, 2023): Good morning, yes I did. I wanna remind that I'm using a docker setup so essentially the steps I did were: - `git clone repo` - edit `.env.example` and save it as `.env` (mainly added GitHub OAuth credentials) - `docker compose build` - `docker-compose up hoppscotch-db` - migrate using `docker exec -it hoppscotch-db bash` and `pnpm exec prisma migrate deploy` - run `docker compose up` It seems I had old cached images and after rebuilding from scratch I don’t have anymore the issue of the table. Now the problem seems to be another: when I try to login using my GitHub OAuth credentials it doesn’t actually login on my Hoppscotch instance but rather keeps showing me the Login button on the top right corner I tested also the smtp but despite the correct credentials, it still fails sending the email (this is a separate issue i’ll take care of later. my goal now is to fix GH authentication)
Author
Owner

@dreamwhite commented on GitHub (Jul 21, 2023):

Regarding the login issue, these are the steps I'm following:

  • visit http://192.168.1.23:3100 (admin page)
  • click on Continue with GitHub
  • authorize the application
  • I should login, but rather I'm redirected to http://192.168.1.23:3000 where my Hoppscotch instance is available

Same happens if I visit http://192.168.1.23:3000. Both of them lead to the same result, namely cannot login:

image

Click on GitHub and automatically get redirected to the homepage:

image

I'm pretty sure the migrations are done, since I see this table in the DB:

image

<!-- gh-comment-id:1645193868 --> @dreamwhite commented on GitHub (Jul 21, 2023): Regarding the login issue, these are the steps I'm following: - visit `http://192.168.1.23:3100` (admin page) - click on `Continue with GitHub` - authorize the application - I should login, but rather I'm redirected to `http://192.168.1.23:3000` where my Hoppscotch instance is available Same happens if I visit `http://192.168.1.23:3000`. Both of them lead to the same result, namely cannot login: ![image](https://github.com/hoppscotch/hoppscotch/assets/17933708/7d885210-6823-4249-80d5-d833d89c810e) Click on GitHub and automatically get redirected to the homepage: ![image](https://github.com/hoppscotch/hoppscotch/assets/17933708/1946eac1-f886-4f03-b317-b49343c66174) I'm pretty sure the migrations are done, since I see this table in the DB: ![image](https://github.com/hoppscotch/hoppscotch/assets/17933708/7655fce8-d5c1-446f-a1ec-b155ab6d6d58)
Author
Owner

@balub commented on GitHub (Jul 24, 2023):

@dreamwhite We use HTTP secure cookies for auth, could you try it over https? this could help.

<!-- gh-comment-id:1647787429 --> @balub commented on GitHub (Jul 24, 2023): @dreamwhite We use HTTP secure cookies for auth, could you try it over `https`? this could [help](https://github.com/hoppscotch/hoppscotch/issues/3060).
Author
Owner

@dreamwhite commented on GitHub (Jul 24, 2023):

Hi, thanks for the reply. Well, I'm self-hosting my hoppscotch instance on my ODROID N2+ at home. Will this still work?
Also please note that the building using docker is really slow on such hardware, mainly due to node_modules directory not being shared across the containers. Can this be fixed?

<!-- gh-comment-id:1648180415 --> @dreamwhite commented on GitHub (Jul 24, 2023): Hi, thanks for the reply. Well, I'm self-hosting my hoppscotch instance on my ODROID N2+ at home. Will this still work? Also please note that the building using docker is really slow on such hardware, mainly due to `node_modules` directory not being shared across the containers. Can this be fixed?
Author
Owner

@webysther commented on GitHub (Jul 30, 2023):

The build process is not a required step to deploy, only for this project because don't support dinamic .env vars to be passed after build is made, but this image skip build process after the first time: https://hub.docker.com/r/webysther/hoppscotch

<!-- gh-comment-id:1657205601 --> @webysther commented on GitHub (Jul 30, 2023): The build process is not a required step to deploy, only for this project because don't support dinamic .env vars to be passed after build is made, but this image skip build process after the first time: https://hub.docker.com/r/webysther/hoppscotch
Author
Owner

@balub commented on GitHub (Jul 30, 2023):

@dreamwhite it seems that you have not run the migration to populate the database with tables. You can follow this to fix the issue you have.

<!-- gh-comment-id:1657228209 --> @balub commented on GitHub (Jul 30, 2023): @dreamwhite it seems that you have not run the migration to populate the database with tables. You can follow [this](https://docs.hoppscotch.io/documentation/self-host/install-and-build/#installing-dependencies) to fix the issue you have.
Author
Owner

@dreamwhite commented on GitHub (Aug 1, 2023):

The build process is not a required step to deploy, only for this project because don't support dinamic .env vars to be passed after build is made, but this image skip build process after the first time: https://hub.docker.com/r/webysther/hoppscotch

Ohhh alright! I'll let you know since I'm experiencing a weird thing with the building process, where the machine hangs probably due to resources allocation...

<!-- gh-comment-id:1659767683 --> @dreamwhite commented on GitHub (Aug 1, 2023): > The build process is not a required step to deploy, only for this project because don't support dinamic .env vars to be passed after build is made, but this image skip build process after the first time: https://hub.docker.com/r/webysther/hoppscotch Ohhh alright! I'll let you know since I'm experiencing a weird thing with the building process, where the machine hangs probably due to resources allocation...
Author
Owner

@AndrewBastin commented on GitHub (Sep 6, 2023):

@dreamwhite closing this issue as the opened objective is fixed. We are refined the build steps in the 2023.8.0 release, please go to Hoppscotch Docs to learn about that.

<!-- gh-comment-id:1708703116 --> @AndrewBastin commented on GitHub (Sep 6, 2023): @dreamwhite closing this issue as the opened objective is fixed. We are refined the build steps in the 2023.8.0 release, please go to [Hoppscotch Docs](https://docs.hoppscotch.io/) to learn about that.
Author
Owner

@dreamwhite commented on GitHub (Sep 24, 2023):

Good evening @AndrewBastin. It seems that on a ODROID N2+ (6 core with 4GBs of RAM) the build process makes the server hang and the only possible way is rebooting it. Is there any workaround like building the app elsewhere (e.g. on my laptop) and then copying it on the server?

<!-- gh-comment-id:1732442486 --> @dreamwhite commented on GitHub (Sep 24, 2023): Good evening @AndrewBastin. It seems that on a ODROID N2+ (6 core with 4GBs of RAM) the build process makes the server hang and the only possible way is rebooting it. Is there any workaround like building the app elsewhere (e.g. on my laptop) and then copying it on the server?
Author
Owner

@AndrewBastin commented on GitHub (Sep 25, 2023):

@dreamwhite we now provide prebuilt containers in Docker Hub. See: https://hub.docker.com/r/hoppscotch/hoppscotch

<!-- gh-comment-id:1732955991 --> @AndrewBastin commented on GitHub (Sep 25, 2023): @dreamwhite we now provide prebuilt containers in Docker Hub. See: https://hub.docker.com/r/hoppscotch/hoppscotch
Author
Owner

@dreamwhite commented on GitHub (Sep 26, 2023):

Good morning @AndrewBastin. Thank you so much! It works flawlessly even when using Traefik as reverse proxy.

Attaching my docker-compose.yml file in case anyone wants to use the same setup:

version: '3.8'
services:
  hoppscotch:
    image: hoppscotch/hoppscotch
    env_file:
      - .env
    depends_on:
      hoppscotch-db:
        condition: service_started
    restart: always
    labels:
      - traefik.enable=true
      - traefik.http.routers.hoppscotch.rule=Host(`hoppscotch.my_domain.ltd`)
      - traefik.port=3000
      - traefik.http.routers.hoppscotch.tls=true
      - traefik.http.routers.hoppscotch.tls.certresolver=lets-encrypt
    networks:
      - web
      - internal

  hoppscotch-db:
    image: postgres
    environment:
      POSTGRES_USER: postgres
      POSTGRES_PASSWORD: testpass # <---- Change this
      POSTGRES_DB: hoppscotch # <---- Change this
      POSTGRES_HOST_AUTH_METHOD: trust  # <---- Kinda unsure about this one. Theoretically speaking of, POSTGRES_PASSWORD shouldn't be needed when using trust method. Need to change it one day
    networks:
      - internal
    labels:
      - traefik.enable=false

networks:
  web:
    external: true
  internal:
    external: false
<!-- gh-comment-id:1735263769 --> @dreamwhite commented on GitHub (Sep 26, 2023): Good morning @AndrewBastin. Thank you so much! It works flawlessly even when using Traefik as reverse proxy. Attaching my `docker-compose.yml` file in case anyone wants to use the same setup: ```yaml version: '3.8' services: hoppscotch: image: hoppscotch/hoppscotch env_file: - .env depends_on: hoppscotch-db: condition: service_started restart: always labels: - traefik.enable=true - traefik.http.routers.hoppscotch.rule=Host(`hoppscotch.my_domain.ltd`) - traefik.port=3000 - traefik.http.routers.hoppscotch.tls=true - traefik.http.routers.hoppscotch.tls.certresolver=lets-encrypt networks: - web - internal hoppscotch-db: image: postgres environment: POSTGRES_USER: postgres POSTGRES_PASSWORD: testpass # <---- Change this POSTGRES_DB: hoppscotch # <---- Change this POSTGRES_HOST_AUTH_METHOD: trust # <---- Kinda unsure about this one. Theoretically speaking of, POSTGRES_PASSWORD shouldn't be needed when using trust method. Need to change it one day networks: - internal labels: - traefik.enable=false networks: web: external: true internal: external: false ```
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hoppscotch#1056
No description provided.