Closed autofas closed 3 months ago
you have a url with the word "port" instead of numbers.. Just remove dthe url, it looks like you are using the options object.
well you're supposed to replace the connection detail placeholders with actual values.
I think the example code is not clear enough, but the explanation is, which makes it a bit confusing. You could split the code in two, one showing only the formatted URL and the other just the options object.
You're welcome to make a PR, but remember it should be understandable in most cases, not just the understandig you have.
I also think the error message you get is fairly clear, so not super high priority imo. The docs do require some level of understanding of hostnames, ports and urls.
I'm using TypeScript with Cypress. Following the example on the README, I did:
But when running the script from Node, I got this error on
postgres/cjs/src/index.js:543:18
:const urlObj = new URL(url.replace(host, host.split(',')[0]))
TypeError [ERR_INVALID_URL]: Invalid URL
As a workaround, I added a comma after the host on the URL and it worked:
postgres://username:password@host,:port/database
Nevertheless, this behavior struck me as very odd. This is an example code.