llamacoder icon indicating copy to clipboard operation
llamacoder copied to clipboard

got an error with prisma

Open longneck84 opened this issue 1 year ago • 4 comments

anyone got following error and how could i fix it?

[ Server ] Error: Invalid prisma.chat.create() invocation:

error: Environment variable not found: DATABASE_URL. --> schema.prisma:7 | 6 | provider = "postgresql" 7 | url = env("DATABASE_URL") |

Validation Error Count: 1

longneck84 avatar Jan 07 '25 06:01 longneck84

I think you have to provide DATABASE_URL in env file with your postgresql database url

yuhanasy avatar Jan 07 '25 10:01 yuhanasy

Yes, provide a DATABASE_URL in your .env file and then these commands, first npx prisma migrate dev and then npx prisma generate

This worked for me.

Afterwards I had to also provide a CSB_API_KEY from codesandbox.io

JRub19 avatar Jan 08 '25 18:01 JRub19

Yes, provide a DATABASE_URL in your .env file and then these commands, first npx prisma migrate dev and then npx prisma generate

This worked for me.

Afterwards I had to also provide a CSB_API_KEY from codesandbox.io

I tried but it didn't work, I got this error: error: Error validating datasource db: the URL must start with the protocol postgresql:// or postgres://.

To use a URL with protocol prisma://, you need to either enable Accelerate or the Data Proxy. Enable Accelerate via prisma generate --accelerate or the Data Proxy via prisma generate --data-proxy.

jaberjaber23 avatar Jan 11 '25 09:01 jaberjaber23

This is how my DATABASE_URL looks like: postgresql://postgres@localhost:5432/together

You run postgresql locally on your pc, create a database and use this URL. I had some issues getting it to run. But you can just use ChatGPT to help set it up. This is how I did it at least

JRub19 avatar Jan 11 '25 15:01 JRub19

issue due to prisma we now have fixed!

riccardogiorato avatar Sep 08 '25 11:09 riccardogiorato