Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When using the ip address in DATABASE_URL, an error is returned. #754

Closed
serega404 opened this issue Oct 6, 2022 · 1 comment
Closed

Comments

@serega404
Copy link

Describe the bug
When using the ip address in DATABASE_URL, an error is returned. I checked, this only happens when using an ip address.

Deployment Method
docker pull ghcr.io/janejeon/blink:latest

docker run -e DATABASE_URL=postgres://blink:pass@192.168.0.120/blink ghcr.io/janejeon/blink:latest npm run db:migrate

To Reproduce
Steps to reproduce the behavior:

  1. docker pull ghcr.io/janejeon/blink:latest
  2. docker run -e DATABASE_URL=postgres://blink:pass@192.168.0.120/blink ghcr.io/janejeon/blink:latest npm run db:migrate
  3. See error "Invalid URL"

Expected behavior
The migration will be successful

Log

# docker run -e DATABASE_URL=postgres://blink:pass@192.168.0.120/blink ghcr.io/janejeon/blink:latest npm run db:migrate

db:migrate
knex migrate:latest

Invalid URL
TypeError [ERR_INVALID_URL]: Invalid URL
at new NodeError (node:internal/errors:371:5)
at onParseError (node:internal/url:552:9)
at new URL (node:internal/url:628:5)
at Object. (/home/node/models/link.js:10:16)
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
npm notice
npm notice New minor version of npm available! 8.5.0 -> 8.19.2
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.19.2
npm notice Run npm install -g npm@8.19.2 to update!
npm notice

@JaneJeon
Copy link
Owner

JaneJeon commented Oct 7, 2022

It is not the database (see how literally nowhere in the error message does it say DATABASE_URL or knex?).

In fact, if you look closely at the error message, you'll see that it is from not configuring the necessary environment variables, which I've extensively documented in both the .env files and the documentation:

Invalid URL
TypeError [ERR_INVALID_URL]: Invalid URL
at new NodeError (node:internal/errors:371:5)
at onParseError (node:internal/url:552:9)
at new URL (node:internal/url:628:5)
at Object. (/home/node/models/link.js:10:16) <---------- here
at Module._compile (node:internal/modules/cjs/loader:1103:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)

See https://github.com/JaneJeon/blink/blob/master/models/link.js#L10. It complaining about invalid URL here most likely means you have not provided BASE_URL, which you haven't in your reproduction.

Please, please, PLEASE for the love of God read the docs. I specifically have a section for deploying with Docker, and I specifically point out in the issue description (that you deleted) that you NEED to read the docs first.

I'm not sure how more explicit about "PLEASE READ THE DOCS" I could've gotten, but clearly you haven't done it.

Please go ahead and read the docs.

Repository owner locked as resolved and limited conversation to collaborators Oct 7, 2022
@JaneJeon JaneJeon closed this as completed Oct 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants