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

Invalid prisma/.env leads to confusing error message #1739

Closed
janpio opened this issue Mar 1, 2020 · 9 comments
Closed

Invalid prisma/.env leads to confusing error message #1739

janpio opened this issue Mar 1, 2020 · 9 comments
Assignees
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. tech/engines/other Issue in the engines repo that does not fit one of the other labels. tech/engines Issue for tech Engines. topic: error
Milestone

Comments

@janpio
Copy link
Member

janpio commented Mar 1, 2020

This prisma/.env:

# Environment variables declared in this file are automatically made available to Prisma.
# See the documentation for more detail: https://pris.ly/d/prisma-schema#using-environment-variables

# Prisma supports the native connection string format for PostgreSQL, MySQL and SQLite.
# See the documentation for all the connection string options: https://pris.ly/d/connection-strings

DATABASE_URL="mysql://root:root@localhost:3306/test_2

(note the missing " at the end)

leads to this confusing error message:

C:\Users\Jan\Documents\throwaway\prisma-test-utils-example>npx prisma2 introspect
Introspecting based on datasource defined in prisma\schema.prisma …
Error: Error in connector: Error querying the database: Error querying the database: The specified database url Error parsing database connection string. is invalid
@pantharshit00 pantharshit00 added bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. labels Mar 4, 2020
@pantharshit00
Copy link
Contributor

pantharshit00 commented Jul 24, 2020

We need to fix this. Sounds like a easy fix so I am going to candidate this.

This is still an issue. I get the same message. Looks like env var is getting ignored if it is invalid.

@janpio janpio added topic: error tech/engines Issue for tech Engines. labels Aug 5, 2020
@janpio janpio added this to the Backlog 2.5.0 milestone Aug 5, 2020
@mavilein mavilein added the tech/engines/other Issue in the engines repo that does not fit one of the other labels. label Aug 6, 2020
@mavilein
Copy link
Member

mavilein commented Aug 6, 2020

Note: The source of this error might be in quaint.

@matthewmueller
Copy link
Contributor

I think we should clean this up in Typescript. I don't think Rust needs to know anything about this.

@pimeys
Copy link
Contributor

pimeys commented Aug 27, 2020

Do I understand this correctly, that in the case @janpio pointed above, the URL sent to the engines is:

"mysql://root:root@localhost:3306/test_2

Meaning, the first character is "? I tried this with the latest Prisma, and it gives me the following error:

Error validating datasource `db`: The URL for datasource `db` must start with the protocol `mysql://`

@pantharshit00
Copy link
Contributor

pantharshit00 commented Aug 27, 2020

Indeed this has been fixed now in the latest version
image

@janpio
Copy link
Member Author

janpio commented Aug 27, 2020

Still not very helpful for me to figure out my .env is invalid - as the string I have in there also starts with the substring it complains about ;)

What does the Engine actually see here? Does it get the " submitted as well as @pimeys implied? Maybe we can get rid of the quotes in the standard .env file completely?

@pimeys
Copy link
Contributor

pimeys commented Aug 27, 2020

Now it's catched by the datamodel parser and errored out. So instead of starting with postgresql://, it starts with a faulty "postgresql:// which is not recognized as a supported scheme.

@janpio janpio modified the milestones: Backlog 2.6.0, Release 2.6.0 Aug 28, 2020
@iRoachie
Copy link

@pantharshit00 Just encountered this error on a brand new project

DATABASE_URL="mysql://root:password@localhost:3306/controltower"

This fails. but works when I remove the quotes

@pantharshit00
Copy link
Contributor

@iRoachie Please open a new issue with a minimal reproduction. Then we can look into it properly and fix it :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. tech/engines/other Issue in the engines repo that does not fit one of the other labels. tech/engines Issue for tech Engines. topic: error
Projects
None yet
Development

No branches or pull requests

6 participants