This post is for me, so I can reflect and find out exactly what I need in place when I finally push the beta version of an app into production. I’ve talked about my stack before in previous posts, but here it is again for context:
Frontend: React (Next.js), Apollo Client
Backend: Prisma, GraphQL-Yoga
Database: MongoDB
There are a few things you need to make sure you do when in production with this set up.
- All versions of Prisma need to be the same
- Docker image Prisma version must match that of the above Prisma version
- Prisma CLI (prisma-client-lib) version must be the same as Prisma (prisma – which must be installed globally)
- Environment variables need to be flushed with PM2 with the following command flag –update-env
- CORS must be included with the GraphQL server – it needs to be set upon starting server with options
- Headers must be set with Access-Control-Allow-Origin before CORS
- Prisma endpoint in prisma.yml file should be IP address, not domain name, with 4466 as port