Timeout instead of error if the user did not configure the database URL
Serverless: timeout instead of error if the user did not configure the database URL. The verified fix is Fix: Anyone who genuinely wants the defaults can explicitly set `host`, `connectionString`, or `PGHOST`. Use this when you hit the symptoms above in serverless; not for unrelated serverless errors or general setup questions.
TL;DR
Fix: Anyone who genuinely wants the defaults can explicitly set host, connectionString, or PGHOST.
The error
Issue neondatabase/serverless#30 (closed, 10 comments): @skyzh's report:
The serverless driver will timeout instead of reporting any error if the user did not configure the database URL. It seems that the driver will try connecting to YOUR_HOST:5432 if the database URL is not configured, and it will timeout. This looks like the default behavior for pg library but I don’t think it makes sense if people are using the serverless driver as they are always connecting to an external provider? I feel it would be better to give a warning / throw an error in the serverless driver in case that the database endpoint is not configured?Fix
- Anyone who genuinely wants the defaults can explicitly set
host,connectionString, orPGHOST.
Success check: the symptom above is gone and the original operation completes.
When to use
- You hit this exact symptom in serverless.
- You want the verified fix without digging through the thread.
When not to use
- A different error in serverless, even a similar-looking one.
- General serverless setup or credential questions.
Compatibility
- Serverless (neondatabase/serverless)
Variant phrasings
- How to fix "timeout instead of error if the user did not configure the database URL" in serverless
- serverless: timeout instead of error if the user did not configure the database URL
- timeout instead of problem if the user did not configure the database URL
Edge cases
- [jawj (maintainer)]: As of driver 0.5.2, the driver throws an error when it detects default connection parameters (missing DATABASEURL / host), instead of hanging until the edge function times out (EDGEFUNCTIONINVOCATIONTIMEOUT with no useful logs).
Source
- https://github.com/neondatabase/serverless/issues/30