how do i create a `production` stage? i’m using th...
# prisma-whats-new
k
how do i create a
production
stage? i’m using the typescript advanced as a base.
prisma deploy --stage production
just redeploys my
dev
stage
n
You need to adjust the
stage
field in
prisma.yml
to a new value (e.g.
prod
or
production
) 🙂
k
that is using
stage: ${env:PRISMA_STAGE}
i hardcoded
production
in there and re-ran
prisma deploy
but it errors
Copy code
ERROR: Whoops. Looks like an internal server error. Search your cluster logs for request ID: cluster:cluster:cje7f3imx160o0187oz0bvp0n

{
  "data": {
    "addProject": null
  },
  "errors": [
    {
      "message": "Whoops. Looks like an internal server error. Search your cluster logs for request ID: cluster:cluster:cje7f3imx160o0187oz0bvp0n",
      "path": [
        "addProject"
      ],
      "locations": [
        {
          "line": 2,
          "column": 9
        }
      ],
      "requestId": "cluster:cluster:cje7f3imx160o0187oz0bvp0n"
    }
  ],
  "status": 200
}
n
Ah, so it pulls the environment variable from
.env
, so you can change it there
k
hmm
so how do i create an
.env.production
and get that to a new target?
the PRISMA_ENDPOINT etc was autogenerated when i started the project
can i do something to autogen
.env.production
?
j
Ideally you should set .env on your deployment env whether that’s a CI or Jenkins. Try dotenv cli you should be able to select something like .env.production
k
i don’t understand how i create and deploy a new “stage” (production) to the cluster though
checking what actually happens when running
prisma init
now
j
when you use the
--stage
flag what you are doing is telling prisma cloud to provision a new namespace, your config should know how to handle that prisma stage variable to switch between config values
k
oh i prefixed with
PRISMA_STAGE=production
and it got a bit further
this seems right, but something wrong with the prisma cloud 🙂
Copy code
$ PRISMA_STAGE=production prisma deploy
Creating stage production for service react-prisma-graphql-shopping-cart !

ERROR: Whoops. Looks like an internal server error. Search your cluster logs for request ID: cluster:cluster:cje8etgq13ylv01188l9ta1lk

{
  "data": {
    "addProject": null
  },
  "errors": [
    {
      "message": "Whoops. Looks like an internal server error. Search your cluster logs for request ID: cluster:cluster:cje8etgq13ylv01188l9ta1lk",
      "path": [
        "addProject"
      ],
      "locations": [
        {
          "line": 2,
          "column": 9
        }
      ],
      "requestId": "cluster:cluster:cje8etgq13ylv01188l9ta1lk"
    }
  ],
  "status": 200
}
j
what command did you use?
prisma deploy
?
k
PRISMA_STAGE=production prisma deploy
sounds like you also need to use the
-e
flag for setting the
.env
file you wish to use
k
yeah, same error
j
attempt to deploy locally using too incase something is in a broken state on cloud
k
same to broken on the cloud indeed
will try to setup local, haven’t done that yet
yeah, works fine local
j
are you able to destroy your remote cluster and re-deploy?
k
yeah, can’t do with with a new stage. anyway, i’ll revisit this later. i have working local cluster and remote cluster, that’s enough for testing + test deploys 🙂
thanks for your time
j
no worries