Budibase / budibase

Low code platform for building business apps and workflows in minutes. Supports PostgreSQL, MySQL, MariaDB, MSSQL, MongoDB, Rest API, Docker, K8s, and more 🚀
https://budibase.com
Other
22.51k stars 1.55k forks source link

[BUDI-6670] Database name cannot be undefined when starting budibase with nginx ingress disabled via helm chart #9862

Closed muscovitebob closed 10 months ago

muscovitebob commented 1 year ago

Checklist

Hosting GKE v1.21 cluster, latest helm chart install.

Describe the bug

Navigating to port forwarded app-service, nothing is shown on page. Backend logs throw an error:

[correlationId=aaa4ab6c-34b6-4747-9883-b0fcb29f6253] [tenantId=default] Trace: [correlationId=aaa4ab6c-34b6-4747-9883-b0fcb29f6253] [tenantId=default] Error: Database name cannot be undefined.
    at new DatabaseImpl (/app/node_modules/@budibase/backend-core/dist/src/db/couch/DatabaseImpl.js:43:19)
    at getDB (/app/node_modules/@budibase/backend-core/dist/src/db/db.js:27:12)
    at Object.getAppDB (/app/node_modules/@budibase/backend-core/dist/src/context/mainContext.js:254:27)
    at /app/dist/api/controllers/static/index.js:105:43
    at Generator.next (<anonymous>)
    at /app/dist/api/controllers/static/index.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/app/dist/api/controllers/static/index.js:4:12)
    at serveApp (/app/dist/api/controllers/static/index.js:104:12)
    at dispatch (/app/node_modules/koa-compose/index.js:42:32)
    at /app/node_modules/@koa/router/lib/router.js:368:16
    at dispatch (/app/node_modules/koa-compose/index.js:42:32)
    at allowedMethods (/app/node_modules/@koa/router/lib/router.js:429:12)
    at dispatch (/app/node_modules/koa-compose/index.js:42:32)
    at /app/node_modules/@koa/router/lib/router.js:368:16
    at dispatch (/app/node_modules/koa-compose/index.js:42:32)
    at print (/app/node_modules/@budibase/backend-core/dist/src/middleware/logging.js:85:5)
    at console.trace (/app/node_modules/@budibase/backend-core/dist/src/middleware/logging.js:95:33)
    at /app/dist/api/index.js:80:21
    at Generator.throw (<anonymous>)
    at rejected (/app/dist/api/index.js:6:65)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
INFO  [1677765543293] (30 on app-service-69894fb96b-985gb): request errored
    res: {
      "statusCode": 500,
      "headers": {
        "vary": "Accept-Encoding",
        "x-budibase-tenant-id": "default",
        "content-type": "application/json; charset=utf-8",
        "content-length": "61"
      }
    }
    err: {
      "type": "Error",
      "message": "failed with status code 500",
      "stack":
          Error: failed with status code 500
              at ServerResponse.onResFinished (/app/node_modules/pino-http/logger.js:77:38)
              at ServerResponse.emit (events.js:412:35)
              at ServerResponse.emit (domain.js:475:12)
              at onFinish (_http_outgoing.js:792:10)
              at callback (internal/streams/writable.js:513:21)
              at afterWrite (internal/streams/writable.js:466:5)
              at afterWriteTick (internal/streams/writable.js:453:10)
              at processTicksAndRejections (internal/process/task_queues.js:81:21)
    }
    responseTime: 3
    req: {
      "id": "aaa4ab6c-34b6-4747-9883-b0fcb29f6253",
      "method": "GET",
      "url": "/api/global/configs/checklist?tenantId=default",
      "headers": {
        "host": "127.0.0.1:8080",
        "connection": "keep-alive",
        "x-budibase-app-id": "",
        "x-budibase-api-version": "1",
        "accept": "application/json",
        "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.3 Safari/605.1.15",
        "accept-language": "en-GB,en;q=0.9",
        "referer": "http://127.0.0.1:8080/builder",
        "accept-encoding": "gzip, deflate"
      },
      "remoteAddress": "::ffff:127.0.0.1",
      "remotePort": 51084
    }
INFO  [1677765543341] (30 on app-service-69894fb96b-985gb): request completed
    res: {
      "statusCode": 200,
      "headers": {
        "vary": "Accept-Encoding",
        "x-budibase-tenant-id": "default",
        "content-type": "text/plain; charset=utf-8",
        "content-length": "2"
      }
    }
    responseTime: 8
    req: {
      "id": "8de9b09d-d402-4c62-9e96-708b3145db6e",
      "method": "POST",
      "url": "/api/bbtel/ping",
      "headers": {
        "host": "127.0.0.1:8080",
        "x-budibase-app-id": "",
        "x-budibase-api-version": "1",
        "accept": "application/json",
        "accept-encoding": "gzip, deflate",
        "accept-language": "en-GB,en;q=0.9",
        "content-type": "application/json",
        "origin": "http://127.0.0.1:8080",
        "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.3 Safari/605.1.15",
        "connection": "keep-alive",
        "referer": "http://127.0.0.1:8080/builder",
        "content-length": "49"
      },
      "remoteAddress": "::ffff:127.0.0.1",
      "remotePort": 51084
    }

Couchdb container logs report continuously:

[error] 2023-03-02T13:56:03.202211Z couchdb@budibase-couchdb-0.budibase-couchdb.budibase.svc.cluster.local emulator -------- Error in process <0.603.0> on node 'couchdb@budibase-couchdb-0.budibase-couchdb.budibase.svc.cluster.local' with exit value:
{database_does_not_exist,[{mem3_shards,load_shards_from_db,"_users",[{file,"src/mem3_shards.erl"},{line,400}]},{mem3_shards,load_shards_from_disk,1,[{file,"src/mem3_shards.erl"},{line,375}]},{mem3_shards,load_shards_from_disk,2,[{file,"src/mem3_shards.erl"},{line,404}]},{mem3_shards,for_docid,3,[{file,"src/mem3_shards.erl"},{line,97}]},{fabric_doc_open,go,3,[{file,"src/fabric_doc_open.erl"},{line,39}]},{chttpd_auth_cache,ensure_auth_ddoc_exists,2,[{file,"src/chttpd_auth_cache.erl"},{line,198}]},{chttpd_auth_cache,listen_for_changes,1,[{file,"src/chttpd_auth_cache.erl"},{line,145}]}]}

Manually creating the _users table in couchdb silences the error in the logs, instead they log repeatedly:

[notice] 2023-03-02T14:03:18.720870Z couchdb@budibase-couchdb-0.budibase-couchdb.budibase.svc.cluster.local <0.4892.0> 0956f46d80 10.0.0.193:5984 10.132.0.10 undefined GET /_up 200 ok 0

However the app-service is still dead, and errors with the same error, even when restarted.

To Reproduce Install budibase helm chart with ingress set to false.

Expected behavior

Working budibase service that is not accessible externally without port forwarding.

BUDI-6670

muscovitebob commented 1 year ago

Related https://github.com/Budibase/budibase/issues/7898

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity.