Next.js Discord

Discord Forum

Prisma doesn't connect to DB in AWS Amplify

Unanswered
elpupper posted this in #help-forum
Open in Discord
I have the t3 turborepo setup i had some issues with env var in amplify not working in SSR but then i solved all of those issues. But now i have the problem of where prisma doesn't connect to the database when deployed. Not sure what to do.

If you need any more information please let me know.

The build locally works perfectly. Just the issue with prisma now im Amplify

44 Replies

bump
@Masai Lion maybe with a littel bit of code we can help you
ok so in the turborepo i have turbo.json setup to have globalEnvs
  "globalEnv": [
    "DATABASE_URL",
  ]
then inside apps/nextjs in next.config.mjs i have the env config
env: {
    DATABASE_URL: process.env.DATABASE_URL ?? "",
  },
and in amplify
Masai Lion
i do not use turborepo but for me it is that way maybe it helps you
in .env
yes
Masai Lion
and thats it
normaly your connected
...
i know man
thats locally
that works fine
everything works fine locally
its deployement
im trying to deploy my website
Masai Lion
ahhh ok i did it in a other one
but it doesnt recognize the database_url env var for some reason
Masai Lion
2 sec
ok go to your package.json
@elpupper
which one 😂
Masai Lion
how many do you have haha
ok
what about it
@Masai Lion how many do you have haha
i lost count
maybe 5
Masai Lion
your gone change the build one like this
i already have that setup in the turbo build
    "build": {
      "dependsOn": ["^build", "^db-generate"],
      "outputs": [".next/**", ".expo/**"]
    },
Masai Lion
its so deferent hahah
monorepo
Masai Lion
ok so i don't know
i did this and for me it works
sorry
damn
day 2 of being stuck