hoppscotch / hoppscotch

Open source API development ecosystem - https://hoppscotch.io (open-source alternative to Postman, Insomnia)

Home Page:https://hoppscotch.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[bug]: while login via the app, backend hoppscotch shows as 503 service unavailable

mrfzy00 opened this issue · comments

Is there an existing issue for this?

  • I have searched the existing issues

Current behavior

The backend shows as error code of 503 service unavailable
image

How do i fix it? Do you have any solutions?

Steps to reproduce

  1. We're manage to create the hoppscotch with Helm charts, so we separate the services.
  2. We also have been state our .env to configmap on K8s, here's the code:
      PORT: "3000"
      DATABASE_URL: postgresql://user_hoppscotch:password@11.12.13.14:5432/tools_hoppscotch # or replace with your database URL 
      # Auth Tokens Config
      JWT_SECRET: "secrets"
      TOKEN_SALT_COMPLEXITY: "10"
      MAGIC_LINK_TOKEN_VALIDITY: "3"
      REFRESH_TOKEN_VALIDITY: "604800000" # Default validity is 7 days (604800000 ms) in ms
      ACCESS_TOKEN_VALIDITY: "86400000" # Default validity is 1 day (86400000 ms) in ms
      SESSION_SECRET: 'Secrets'
      # Hoppscotch App Domain Config
      REDIRECT_URL: "https://hoppscotch.xxx.xxx"
      WHITELISTED_ORIGINS: "https://hoppscotch.xxx.xxx,https://hoppscotch-admin.xxx.xxx,https://hoppscotch-be.xxx.xxx"
      # Google Auth Config
      GOOGLE_CLIENT_ID: "*******"
      GOOGLE_CLIENT_SECRET: "***********"
      GOOGLE_CALLBACK_URL: "https://hoppscotch-be.xxxx.xxxx/v1/auth/google/callback"
      GOOGLE_SCOPE: "email,profile"
      # Rate Limit Config
      RATE_LIMIT_TTL: "60" # In seconds
      RATE_LIMIT_MAX: "100" # Max requests per IP
      MAILER_SMTP_URL: "smtps://user@domain.com:pass@smtp.domain.com"
      MAILER_ADDRESS_FROM: "from@example.com"
      VITE_ALLOWED_AUTH_PROVIDERS: "GOOGLE"
      VITE_BASE_URL: https://hoppscotch.xxx.xxx
      VITE_SHORTCODE_BASE_URL: https://hoppscotch.xxx.xxx
      VITE_ADMIN_URL: https://hoppscotch-admin.xxx.xxx

      # Backend URLs
      VITE_BACKEND_GQL_URL: https://hoppscotch-be.xxx.xxx/graphql
      VITE_BACKEND_WS_URL: wss://hoppscotch-be.xxx.xxx/graphql
      VITE_BACKEND_API_URL: https://hoppscotch-be.xxx.xxx/v1

      # Terms Of Service And Privacy Policy Links (Optional)
      VITE_APP_TOS_LINK: https://docs.hoppscotch.io/terms
      VITE_APP_PRIVACY_POLICY_LINK: https://docs.hoppscotch.io/privacy 

      ENABLE_SUBPATH_BASED_ACCESS: "false"
  1. After that, it was run as we expected, but only accessible is frontend, admin shows blank pages, and backend was stated above.

Environment

Production

Version

Self-hosted

Hey @mrfzy00 could you share your nginx config file here ?

hi @balub , i'm using the nginx ingress, not using nginx here's the config:

    ingress:
      enabled: true
      className: "nginx"
      annotations:
        #kubernetes.io/ingress.class: nginx
        cert-manager.io/cluster-issuer: letsencrypt-staging
        # kubernetes.io/tls-acme: "true"
      hosts:
        - host: hoppscotch-be.xxx.xxx
          paths:
            - path: /
              pathType: ImplementationSpecific
      tls:
      - secretName: hoppscotch-be-tls
        hosts:
          - hoppscotch-be.xxx.xxx
      service:
        port: 3000

@mrfzy00 could you check if the backend service is up and active, maybe calling the ping route? When we spin up the backend for the first time we populate the DB with config props and terminate it, If it's docker we use the --restart unless-stopped flag to restart the container when we do this, maybe in your case it didn't restart automatically. Could you just check this once?

This explains why you can only see the Hoppscotch app and not the admin app and the Backend because the Hoppscotch app is cached with a service worker so you can use it offline. But can you log in and do other things related to workspaces in it though?

@mrfzy00 are you still facing this issue?

hi @balub , sorry of late updating, my team just resolved the issues, it has been related to our template deployment on helm charts:

apiVersion: v1
kind: Service
metadata:
  name: {{ include "hoppscotch-app.fullname" . }}
  labels:
    {{- include "hoppscotch-app.labels" . | nindent 4 }}
spec:
  type: ClusterIP
  ports:
    - port: 3000
      targetPort: http-app
      protocol: TCP
      name: http-app
  selector:
    {{- include "hoppscotch-app.selectorLabels" . | nindent 4 }}

while accessing the services, it seems the service wont recognized, but with that code above, we resolved this issue. i will close the issue.