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

Improve error message when running prisma with an outdated client #1008

Open
AdeelK93 opened this issue Aug 11, 2024 · 0 comments
Open

Improve error message when running prisma with an outdated client #1008

AdeelK93 opened this issue Aug 11, 2024 · 0 comments
Labels
kind/improvement An improvement to existing feature and code. level/intermediate priority/medium topic: dx Improvements or issues relating to developer experience
Milestone

Comments

@AdeelK93
Copy link
Contributor

AdeelK93 commented Aug 11, 2024

Problem

When upgrading to a newer version of prisma python client - let's say, 0.13.1 to 0.14.0, if you forget to run prisma generate again, you'll get an error message like this

File "/Users/adeel/Documents/GitHub/my-project/backend/utils/db.py", line 36, in get_db
_db = Prisma(auto_register=True, datasource={"url": get_db_uri(application_name)})
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/adeel/Library/Caches/pypoetry/virtualenvs/my-project-cJkWU15t-py3.12/lib/python3.12/site-packages/prisma/client.py", line 156, in init
self._set_generated_properties(
TypeError: BasePrisma._set_generated_properties() missing 1 required keyword-only argument: 'preview_features'

It's not very obvious based on this preview_features message that this error actually stems from an outdated client.

Suggested solution

The prisma library already knows prisma.__version__. We should also track the version used for generating the client - and if it's missing or mismatched, raise an error.

Alternatives

Additional context

@RobertCraigie RobertCraigie added kind/improvement An improvement to existing feature and code. level/intermediate priority/medium topic: dx Improvements or issues relating to developer experience labels Aug 11, 2024
@RobertCraigie RobertCraigie added this to the 0.16.0 milestone Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/improvement An improvement to existing feature and code. level/intermediate priority/medium topic: dx Improvements or issues relating to developer experience
Projects
None yet
Development

No branches or pull requests

2 participants