tursodatabase / tursodatabase/libsql

LibsqlError: URL_INVALID when deploying to Render

Open
#1,121 30 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
17.2k
Forks
531
Avg merge
1h 12m
Merged PRs (30d)
1

Description

Localy works, but when deploying on Render.

db.js:

let dotenv = require('dotenv').config()
const { createClient } = require('@libsql/client')
const { drizzle } = require('drizzle-orm/libsql')
const client = createClient({
  url: dotenv.parsed.TURSO_URL,
  authToken: dotenv.parsed.TURSO_AUTH_TOKEN,
})
module.exports = drizzle(client)

"dependencies": {
"@libsql/client": "^0.5.2",
"cors": "^2.8.5",
"dotenv": "^16.4.5",
"drizzle-orm": "^0.29.4",
"ejs": "^3.1.9",
"events": "^3.3.0",
"express": "^4.18.2",
"express-session": "^1.17.3",
"fs": "^0.0.1-security",
"nodemon": "^3.0.2",
"passport": "^0.7.0",
"passport-local": "^1.0.0"
},

/opt/render/project/src/node_modules/@libsql/core/lib-cjs/uri.js:12
throw new api_js_1.LibsqlError("The URL is not in a valid format", "URL_INVALID");
^
LibsqlError: URL_INVALID: The URL is not in a valid format
at parseUri (/opt/render/project/src/node_modules/@libsql/core/lib-cjs/uri.js:12:15)
at expandConfig (/opt/render/project/src/node_modules/@libsql/core/lib-cjs/config.js:35:39)
at createClient (/opt/render/project/src/node_modules/@libsql/client/lib-cjs/node.js:28:52)
at Object. (/opt/render/project/src/db.js:4:16)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18) {
code: 'URL_INVALID',
rawCode: undefined,
[cause]: undefined
}
Node.js v20.11.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with db.js and the createClient call, then compare the environment available during local execution with the variables provided by the Render deployment. Read the stack-trace entries in @libsql/core/lib-cjs/uri.js and config.js, and reproduce the deployment failure. Done means the Render deployment accepts the configured URL and starts without URL_INVALID.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
cloud, databases
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.