Current behavior
When I try to a deploy my prisma-based graphql server to now.sh using this official tutorial, npm run build fails with the following:
Benjamins-MacBook-Pro:prisma-server benjaminlowenstein$ now -T betterme --dotenv .env.production
UPDATE AVAILABLE The latest version of Now CLI is 10.2.1
> Deploying ~/dev/evolve/prisma-server under betterme
> Using Node.js 8.10.0 (default)
> Ready! https://prisma-server-hntmwdoljw.now.sh (copied to clipboard) [5s]
> Synced 15 files (239.77KB) [5s]
> Initializing…
> Building
> â–² npm install
> ⧗ Installing 14 main dependencies…
> ✓ Installed 917 modules [10s]
> â–² npm run build
> [email protected] build /home/nowuser/src
> rm -rf dist && graphql prepare && tsc
> npm ERR! errno 1
> npm ERR! [email protected] build: `rm -rf dist && graphql prepare && tsc`
> npm ERR! Exit status 1
> npm ERR!
> npm ERR! Failed at the [email protected] build script.
> npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
> npm ERR! /home/nowuser/.npm/_logs/2018-03-20T04_23_55_831Z-debug.log
> Cluster evolve, that is provided in the prisma.yml could not be found.
> If it is a private cluster, make sure that you're logged in with prisma login
> npm ERR! A complete log of this run can be found in:
> npm ERR! code ELIFECYCLE
Reproduction
If your problem can be reproduced with a certain service definition, please create a new GitHub repository with the reproduction instructions.
Expected behavior?
The server builds successfully via now, and the build step succeeds
Additionally, worth noting that the tutorial seems to imply that now can only be done with a public cluster
With help of @lionstone we confirmed that this addition resolves the problem:
In your now build script, add
prisma login --key <CLOUD SESSION KEY>
You can find a valid cloud session key in your ~/.prisma/config.yml file on the machine you are logged in.
This note should be added to the tutorial.
This is what I'm doing:
now secret set prisma-token $(prisma token)
and then setting the env variable to the value of the secret
"env": {
"PRISMA_CLOUD_SESSION_KEY": "@prisma-token"
}
Thanks for finding this out!
@nikolasburk - we should make sure this is properly reflected in the docs at https://www.prisma.io/docs/tutorials/graphql-server-development/deployment-with-now-ahs1jahkee
Thanks for opening this issue @lionstone! As private clusters in private cloud don't exist any more, I'm closing this issue.
Most helpful comment
With help of @lionstone we confirmed that this addition resolves the problem:
In your
nowbuild script, addYou can find a valid cloud session key in your
~/.prisma/config.ymlfile on the machine you are logged in.This note should be added to the tutorial.