Hi, I’ve been looking around for a bit and did not find a similar issue on the forum so here goes.
I’m trying to run ghost in a Kubernetes cluster and trying to use the environment variables for provisioning purposes. The instance of ghost deployed seem to crash seconds after starting with the following message: The "id" argument must be of type string. Received undefined
.
I updated the container to include the DEBUG
env set at ghost:*,ghost-config
as per the documentation recommends. The log outputs is as follows (without including my config part):
2023-03-10T18:40:39.475Z ghost:config config end
2023-03-10T18:40:39.476Z ghost:boot End: Load config
2023-03-10T18:40:39.476Z ghost:boot Begin: Load logging
2023-03-10T18:40:39.655Z ghost:boot End: Load logging
2023-03-10T18:40:39.655Z ghost:boot Begin: Add unhandled rejection handler
2023-03-10T18:40:39.655Z ghost:boot End: Add unhandled rejection handler
2023-03-10T18:40:39.655Z ghost:boot Begin: Load sentry
2023-03-10T18:40:39.786Z ghost:boot End: Load sentry
2023-03-10T18:40:39.786Z ghost:boot Begin: load server + minimal app
2023-03-10T18:40:40.327Z ghost:shared:express new app start root
2023-03-10T18:40:40.329Z ghost:shared:express new app end root
2023-03-10T18:40:40.334Z ghost:server Starting...
2023-03-10T18:40:40.341Z ghost:server ...Started
[2023-03-10 18:40:40] INFO Ghost is running in production...
[2023-03-10 18:40:40] INFO Your site is now available on http://example.com/
[2023-03-10 18:40:40] INFO Ctrl+C to shut down
2023-03-10T18:40:40.352Z ghost:server Notifying server ready (success)
[2023-03-10 18:40:40] INFO Ghost server started in 1.145s
2023-03-10T18:40:40.354Z ghost:boot End: load server + minimal app
2023-03-10T18:40:40.354Z ghost:boot Begin: Get DB ready
[2023-03-10 18:40:40] INFO Database is in a ready state.
[2023-03-10 18:40:40] INFO Ghost database ready in 1.538s
2023-03-10T18:40:40.747Z ghost:boot End: Get DB ready
2023-03-10T18:40:40.747Z ghost:boot Begin: Load Ghost Services & Apps
2023-03-10T18:40:40.747Z ghost:boot Begin: initCore
2023-03-10T18:40:40.747Z ghost:boot Begin: Load urlUtils
2023-03-10T18:40:40.747Z ghost:boot End: Load urlUtils
2023-03-10T18:40:40.747Z ghost:boot Begin: models
[2023-03-10 18:40:40] ERROR The "id" argument must be of type string. Received undefined
The "id" argument must be of type string. Received undefined
Error ID:
0eb9df40-bf73-11ed-8b48-8142ebb19a32
Error Code:
ERR_INVALID_ARG_TYPE
----------------------------------------
TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received undefined
at bootGhost (/var/lib/ghost/versions/5.37.0/core/boot.js:531:32)
at new NodeError (node:internal/errors:387:5)
at validateString (node:internal/validators:162:11)
at Module.require (node:internal/modules/cjs/loader:1086:3)
at require (node:internal/modules/cjs/helpers:108:18)
at Object.<anonymous> (/var/lib/ghost/versions/5.37.0/core/server/data/schema/default-settings/index.js:4:25)
at Module._compile (node:internal/modules/cjs/loader:1191:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1245:10)
at Module.load (node:internal/modules/cjs/loader:1069:32)
at Function.Module._load (node:internal/modules/cjs/loader:904:12)
at Module.require (node:internal/modules/cjs/loader:1093:19)
at require (node:internal/modules/cjs/helpers:108:18)
at Object.<anonymous> (/var/lib/ghost/versions/5.37.0/core/server/data/schema/index.js:3:34)
at Module._compile (node:internal/modules/cjs/loader:1191:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1245:10)
at Module.load (node:internal/modules/cjs/loader:1069:32)
at Function.Module._load (node:internal/modules/cjs/loader:904:12)
2023-03-10T18:40:40.758Z ghost:boot Notifying server ready (error)
[2023-03-10 18:40:40] WARN Ghost is shutting down
[2023-03-10 18:40:40] WARN Ghost has shut down
[2023-03-10 18:40:40] WARN Your site is now offline
[2023-03-10 18:40:40] WARN Ghost was running for a few seconds
I looked around the documentation and did not see any environment variable nor flags that i could user to resolve the issue tied to any id
argument. I tried my luck by fixing the id
argument to whatever string came to mind to check but the error message did not change.
Here is my deployment configuration:
apiVersion: apps/v1
kind: Deployment
metadata:
name: blog
labels:
app: blog
spec:
replicas: 1
selector:
matchLabels:
app: blog
template:
metadata:
labels:
app: blog
spec:
containers:
- name: ghost
image: ghost:5.37.0-alpine
imagePullPolicy: Always
ports:
- containerPort: 2368
name: http
protocol: TCP
env:
- name: url
value: http://example.com
- name: paths
value: /blog
- name: database__client
value: mysql
- name: database__connection__host
value: my_remote_database_endpoint
- name: database__connection__user
value: ghost_user
- name: database__connection__password
value: password
- name: database__connection__database
value: ghost
- name: DEBUG
value: ghost:*,ghost-config
volumeMounts:
- mountPath: /var/lib/ghost/content
name: ghost-data
volumes:
- name: ghost-data
persistentVolumeClaim:
claimName: blog-ghost
I tried using the regular 5.37.0
instead of 5.37.0-alpine
and 4.48.9
image version (with path
instead of id
in the error message / i could not find the documentation for 4.x.x versions). I tried again with 5.20.0-alpine
but with the same outcome as described earlier. I don’t know where to start looking in the codebase because my dev skills are close to non-existent and my attempts to look into the codebase on Github failed so far. Did someone happened to have the same or similar issue and found a fix?
Thank you!