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

Fix misleading error when db.url is undefined #8696

Merged
merged 2 commits into from Jul 13, 2023
Merged

Fix misleading error when db.url is undefined #8696

merged 2 commits into from Jul 13, 2023

Conversation

dcousens
Copy link
Member

@dcousens dcousens commented Jul 13, 2023

When config.db.url was undefined - although not allowed by our types - users were faced with the following error:

TypeError: Cannot read properties of undefined (reading 'startsWith')

This can happen if, for example, someone used db.url: process.env.DATABASE_URL!.
You shouldn't do this, but, the error doesn't need to be terrible, when the alternative is that Prisma will inform you that your connection url is empty.

Some day, we should use something like zod to validate a users configuration.

@changeset-bot

This comment was marked as resolved.

@dcousens dcousens requested a review from borisno2 July 13, 2023 06:10
@dcousens dcousens self-assigned this Jul 13, 2023
@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit a46ebf9:

Sandbox Source
@keystone-6/sandbox Configuration

@dcousens dcousens merged commit 57db80e into main Jul 13, 2023
58 checks passed
@dcousens dcousens deleted the better-errors branch July 13, 2023 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants