Postgres invalid input syntax for type timestamp with time zone

Hi, I can’t get the Wait node to work it keeps spinning and also gives error:
“Worflow execution has an error”
When I check the Postgres docker error log I have:
ERROR: invalid input syntax for type timestamp with time zone: “0NaN-NaN-NaNTNaN:NaN:NaN.NaN+NaN:NaN”

this is my docker-compose.yaml file

version: ‘3.8’

volumes:
db_storage4:
n8n_storage4:
redis_storage4:

x-shared: &shared
restart: always
image: docker.n8n.io/n8nio/n8n
environment:
- DB_TYPE=postgresdb
- DB_POSTGRESDB_HOST=postgres
- DB_POSTGRESDB_PORT=5432
- DB_POSTGRESDB_SCHEMA=n8n
- WEBHOOK_URL=https://domain-name.com/
- DB_POSTGRESDB_DATABASE=${POSTGRES_DB}
- DB_POSTGRESDB_USER=${POSTGRES_NON_ROOT_USER}
- DB_POSTGRESDB_PASSWORD=${POSTGRES_NON_ROOT_PASSWORD}
- EXECUTIONS_MODE=queue
- QUEUE_BULL_REDIS_HOST=redis
- QUEUE_HEALTH_CHECK_ACTIVE=true
- N8N_ENCRYPTION_KEY=${N8N_ENCRYPTION_KEY}
- GENERIC_TIMEZONE=${GENERIC_TIMEZONE}
links:
- postgres
- redis
volumes:
- n8n_storage4:/home/node/.n8n
depends_on:
redis:
condition: service_healthy
postgres:
condition: service_healthy

services:
postgres:
image: postgres:16
restart: always
environment:
- POSTGRES_USER=${POSTGRES_USER}
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_DB=${POSTGRES_DB}
- POSTGRES_NON_ROOT_USER=${POSTGRES_NON_ROOT_USER}
-POSTGRES_NON_ROOT_PASSWORD=${POSTGRES_NON_ROOT_PASSWORD}
- DB_POSTGRESDB_SCHEMA=n8n
volumes:
- db_storage4:/var/lib/postgresql/data
- ./init-data.sh:/docker-entrypoint-initdb.d/init-data.sh
healthcheck:
test: [‘CMD-SHELL’, ‘pg_isready -h localhost -U ${POSTGRES_USER} -d ${POSTGRES_DB}’]
interval: 5s
timeout: 5s
retries: 10

redis:
image: redis:6-alpine
restart: always
volumes:
- redis_storage4:/data
healthcheck:
test: [‘CMD’, ‘redis-cli’, ‘ping’]
interval: 5s
timeout: 5s
retries: 10

n8n:
<<: *shared
ports:
- 5678:5678

n8n-worker:
<<: *shared
command: worker
depends_on:
- n8n

Thanks a lot for your very much needed help

Regards

Information on your n8n setup

  • n8n version: 1.55.3
  • Database : Postgres
  • n8n EXECUTIONS_PROCESS setting: queue
  • Running n8n via (Docker compose:
  • Operating system:Ubuntu 22.04.4

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

I have created a new database grant all permissions to user changed the database in the yaml file and re recreate the container, the log shows the migrations happenning, I connected to postgres docker to the new database the schema n8n has been created I checked the table execution_entity of schema n8n the lines of wait node are there but the field wait is empty , I have also an other error on the first screen, when i choose team size less than 20 it says

Error while submitting results

companySize: Potentially malicious string

Thanks again for your help, if someone has postgres in docker working please can you just share your yaml file it will be much appreciated thank you very much

anybody has any idea please ?
or can anyone please with n8n running in docker with postgres just share his docker-compose.yaml ?
thank you

HI @youssef_Cm, sorry to hear that you’re having issues with the Wait node.

Could you tell us a bit more about what you’re trying to achieve with the workflow? Or even better, share your workflow JSON by copy & pasting between (```)?

Have you checked whether the date/time inputs being passed to the wait node are in valid recognized formats? Also, have you checked that the timezone is correctly configured? Set the self-hosted instance timezone | n8n Docs

You might know this already but you can find an example of n8n + Postgres docker-compose.yml file here: n8n-hosting/docker-compose/withPostgres at main · n8n-io/n8n-hosting · GitHub

Hi Aya, thanks a lot for your answer because I am still stuck with no solution, yes I have used the the docker-compose.yaml available in Git, I posted it in my first post as well, I have also checked data and tried different format, ISO plus timezone, timestamp and other variations
This is the json of the workflow:

Thanks again for your help

The error in your PostgreSQL log suggests that an invalid date or time value is being passed into the Wait node so these are the things I would try next:

  • What is the output of your second Date & Time node in your workflow and which format is it in? Can you pin your data? (check that it’s in YYYY-MM-DDTHH:mm:ss format)
  • I’ll also try to set the Postgres timezone to UTC, and then enter the timestamp in UTC format to rule out timezone mismatch

Let me know if that helps!