rudolfbono
01/05/2022, 5:36 PMnpm run build
the Next app before running npm run test
.
Problem: I get the error Error: supabaseUrl is required
during the build step.
This is happening because createClient(process.env.NEXT_PUBLIC_SUPABASE_URL ?? '', process.env.SUPABASE_SERVICE_ROLE_KEY ?? '')
runs on the client-side and I haven't passed those 2 environment variables to the GH action.
Solutions I'm looking at:
a) Add prod DB environment variables to the GH action so createClient()
doesn't throw an error. This feels too dangerous.
b) Create a special 'test' environment and pass its env variables to the GH action. This sounds like a lot of work as I'll have to manually keep the test DB in sync with prod DB.
c) Move createClient()
onto server-side and expose the client instance as an API for my frontend to consume. This way, npm run build
wouldn't need those ENV variables to build correctly. Is this even possible?
Thoughts 🙂 ?silentworks
01/05/2022, 6:22 PMrudolfbono
01/05/2022, 8:15 PMcreateClient()
throws an error.
Is it possible for createClient()
to live server-side?silentworks
01/05/2022, 8:16 PMservice_role
keysilentworks
01/05/2022, 8:17 PMadmin.js
and another in db.js
rudolfbono
01/05/2022, 8:32 PMrudolfbono
01/05/2022, 8:33 PMsilentworks
01/05/2022, 8:51 PMrudolfbono
01/05/2022, 9:04 PM