Hi, After upgrading to 2.17 I am suddenly seeing a...
# prisma-client
a
Hi, After upgrading to 2.17 I am suddenly seeing a lot of errors in node_modules/.prisma/client/index.d.ts and my nestjs build step is failing. Here is a sample log. I am not sure what's happening here since I even downgraded back to 2.16 and deleted node_modules and did a fresh rebuild but even then these errors remain. Don't know if it's something related to Prisma or just at my end.
r
@Akash 👋 I cannot reproduce this after upgrading. Could you try running
prisma generate
and restart your editor?
a
Tried everything. Regenerated prisma both with 2.17 and 2,16, deleted and rebuilt everything. I think this is something at my end only otherwise it should have been fixed by the downgrade. Let me see. Trying to dig deeper. Will update if I find a fix.
👍 1
Looks like there is some issue. Happening with my team as well post the update. Raising it on github.
👍 1
j
Found it https://github.com/prisma/prisma/issues/5702 What’s your TypeScript version?
a
Version 4.1.3
j
So latest, that looks good
a
Yes. I am also trying to debug the issue. Looks like there are some unique constraints which have a . in their name like this
payroll_employees.clustering_company_id_index
for which the types are getting incorrectly generated. But there are lot of other issues as well. Will keep you updated with anything I find.
👍 1
j
Oh interesting, if you can send me the schema, I’m curious to check it
a
sure. sharing it on DM.
👍 1
Looks like I have found the issue. Reverting to old version helped fixed the issue. Here is the difference between generated types in 2.16 vs 2.17. 2.16
Copy code
export type payroll_kw_wallet_transactionsTypeSourceInvoice_idStatusCompoundUniqueInput = {
    type: payroll_kw_wallet_transactions_types
    source: payroll_kw_wallet_transaction_source
    invoice_id: string
    status: payroll_transaction_status
}
2.17
Copy code
export type payroll_kw_wallet_transactionsPayroll_kw_wallet_transactions.type_source_invoice_id_status_unCompoundUniqueInput = {
    type: payroll_kw_wallet_transactions_types
    source: payroll_kw_wallet_transaction_source
    invoice_id: string
    status: payroll_transaction_status
}
Look at the difference in the names. Typescript isn't allowing
.
in the type name and hence the issue.
t
Thanks @Akash! We’ll have a look at this and let you know once a fix is available
👍 2
a
@tim2 Just one more update so that it helps you debug the issue. This doesn't look to be an issue with Prisma version. The problem was that I introspected my schema just to make it in sync with existing DB. So in my schema the unique constraints got changed from
@@unique([type, source, invoice_id, status])
to
@@unique([type, source, invoice_id, status], name: "payroll_kw_wallet_transactions.type_source_invoice_id_status_un")
which on being generated by Prisma is leading to this incorrect type naming issue in both the versions. This was the reason reverting only the version earlier didn't help. Please let me know when a fix is available. For now I will remove the naming from my schema.
👍 2
j
@do4gr seems something for you
a
Also this is only happening with compound unique constraints. Single unique constraints seem to be working fine even with
.
in the name
👍 1
t
@Akash so removing the name fixes this for you? Then please go with that for now. It turned out, we have an issue for this already https://github.com/prisma/prisma/issues/3193
We won't immediately work on this now, but you can just check out that issue to track the progress
a
Yes @tim2. Removing names fixed it for me. Although I think there should be some long term solution since constraints with a
.
in the name are being generated by prisma itself which is leading to this issue.
👍 1
t
Thanks for letting us know! Yes, that is what the issue is about, it’s definitely something we want to fix
👍 1