NB CLI connection error

Hello NocoBase team.
I’m just learning Nocobase and trying to figure out how to connect an agent to a self-hosted Docker / https / v2.2.21 NocoBase env.

  1. Created API key/Root the process is completed with an error:
Syncing agent skills
Agent skills ready.
Connecting to the env
Updating env runtime: nb-env
Failed to update env "nb-env".
Failed to load swagger schema from `swagger:get`.
undefined
Current  Name        Kind  API Base URL               Auth   Runtime
-------  ----------  ----  -------------------------  -----  -------
*        nb-env  http  https://nb.env/api  token
Env         Status  API Base URL
----------  ------  -------------------------
nb-env  error   https://nb.env/api
  1. I decided that there are restrictions on root access for the api, created access for the administrator role:
Syncing agent skills
⚠ Warning: Couldn't reach the npm registry to sync NocoBase AI coding skills. Skipping skills install and continuing init. Run `nb skills install` later when registry access is available.
Connecting to the env
Updating env runtime: nb-env
Failed to update env "nb-env".
Failed to load swagger schema from `swagger:get`.
undefined

status and list
Same results

  1. Try with basic auth:
Connecting to the env
Authenticating
Signing in with username and password for "nb-env"...
Authentication failed for "nb-env".
Basic sign-in succeeded but no token was returned.

status
nb-env is still in error status at https://nb.env/api`

list
nb-env is the current environment. API URL: https://nb.env/api; authentication: basic . Runtime is not listed.

My proxy server forwards port 443 port to https://nb.env the application is running on the docker port 13000, but perhaps you need separate ports for the api?

The list command shows an http connection, but am I actually using https?

Thanks for the detailed report. You do not need a separate port for the API. NocoBase serves the web UI and the API on the same application port (default 13000); the API is simply exposed under the /api path. Your reverse proxy only needs to forward both https://nb.env/ and https://nb.env/api/* to the NocoBase container.

Two clarifications and checks:

  1. The Kind column showing “http” is the CLI env connection type (a remote HTTP env), not the URL scheme. Your environment is still using https.

  2. The errors “Failed to load swagger schema from swagger:get” and the basic sign-in message usually mean the CLI cannot read a valid API response through the proxy. Please verify:

    • Open https://nb.env/api/swagger:get directly in a browser (or with curl). It must return JSON (an OpenAPI document), not an HTML page, a redirect, or a TLS error.
    • The reverse proxy forwards all /api/* requests to the NocoBase container port, preserves headers (Host, X-Forwarded-Proto), and supports WebSocket (/ws).
    • If APP_PUBLIC_PATH / API base path is customized, the external path must match your API base URL, which should end with /api.

After fixing the proxy, re-run: nb env add --api-base-url https://nb.env/api (or nb env update ), then nb env status should show ok.

If https://nb.env/api/swagger:get already returns valid JSON directly, please share that raw response and your nb --version output so we can look deeper.

See the CLI multi-environment guide: NocoBase Documentation

1 Like
{
errors: [
{
message: "Unauthenticated. Please sign in to continue.",
code: "EMPTY_TOKEN"
}
]
}

Thanks! The issue is resolved. There is a problem with the headers of the proxy server.