Describe the bug
On execution of prisma deploy, the CLI responds with Error: Token is issued in the future (iat).
To Reproduce
Steps to reproduce the behavior:
prisma deployExpected behavior
The expected behavior would be to correctly deploy the schema to the hosted DB, and execute the post-deploy script to get the generated schema.
Screenshots
Here is the full error logs with DEBUG="*" on prisma deploy
````
deploy checking if project exists +0ms
client Sending query to cluster default +0ms
client https://api.my-website.com/management +0ms
client
client query($name: String! $stage: String!) {
client project(name: $name stage: $stage) {
client name
client stage
client }
client }
client +1ms
client { name: 'charmant', stage: 'dev' } +1ms
deploy adding project +270ms
Creating stage dev for service charmant... client Sending query to cluster default +268ms
client https://api.my-website.com/management +1ms
client mutation addProject($name: String! $stage: String! $secrets: [String!]) {
client addProject(input: {
client name: $name,
client stage: $stage
client secrets: $secrets
client }) {
client project {
client name
client }
client }
client }
client +0ms
client { name: 'charmant',
client stage: 'dev',
client secrets: [ 'REDACTED' ] } +2ms
!
Error: Token is issued in the future (iat).: {"response":{"data":{"addProject":null},"errors":[{"locations":[{"line":2,"column":9}],"path":["addProject"],"code":3015,"message":"Token is issued in the future (iat).","requestId":"local:cjsexk4sk000x07413n4kkgb8"}],"status":200},"request":{"query":" mutation addProject($name: String! $stage: String! $secrets: [String!]) {n addProject(input: {n name: $name,n stage: $stagen secrets: $secretsn }) {n
project {n namen }n }n }n ","variables":{"name":"charmant","stage":"dev","secrets":["REDACTED"]}}}
at GraphQLClient.
at step (C:UsersjchuetAppDataRoamingnpmnode_modulesprismanode_modulesgraphql-requestdistsrcindex.js:40:23)
at Object.next (C:UsersjchuetAppDataRoamingnpmnode_modulesprismanode_modulesgraphql-requestdistsrcindex.js:21:53)
at fulfilled (C:UsersjchuetAppDataRoamingnpmnode_modulesprismanode_modulesgraphql-requestdistsrcindex.js:12:58)
at processTicksAndRejections (internal/process/next_tick.js:81:5)
Exiting with code: 1
````
Versions (please complete the following information):
prisma CLI: 1.27 & 1.28Additional context
I had some issues correctly configuring the PostgreSQL side (since we are not given superuser on the new DO Managed DBs platform), so the issue could stem from this side. I just have a hard figuring out what exactly does this error entail.
Here is my setup:
DB SIDE - on DigitalOcean DB
config.yml
port: 4466
managementApiSecret: REDACTED
databases:
default:
connector: postgres
host: REDACTED.db.ondigitalocean.com
database: charmant-glouton
user: prisma-charmant
password: REDACTED
schema: charmant-glouton
rawAccess: true
port: '25060'
migrations: true
ssl: true
dockerfile
FROM prismagraphql/prisma:1.27
ARG PRISMA_CONFIG_PATH
ENV PRISMA_CONFIG_PATH prisma.yml
COPY config.yml prisma.yml
EXPOSE 4466
BACKEND SIDE
prisma.yml
endpoint: ${env:PRISMA_ENDPOINT_DEV}
datamodel: datamodel.prisma
secret: ${env:PRISMA_SECRET}
hooks:
post-deploy:
- graphql get-schema -p prisma
.graphqlconfig.yml
projects:
app:
schemaPath: "src/schema.graphql"
extensions:
endpoints:
default: "http://localhost:4444"
prisma:
schemaPath: "src/generated/prisma.graphql"
extensions:
prisma: prisma.yml
@BiscuiTech
Can you please check your server's system time?
Also, please check your own machine's system time. It looks like somehow iat is exceeding the current time in the server.
Thanks for the quick reply.
On my own machine - local dev (where prisma deploy is executed):
Thursday, February 21, 2019 1:33:55 PM
On the hosted prisma server:
Thu Feb 21 13:33:52 EST 2019
On the DB:
"2019-02-21 13:33:57.889423-05"
Please disregard the seconds as I had to manually switch windows to excute those commands.
Time looks good. cc @mavilein any idea here?
I have fixed this issue by changing my internet time provider to gov on my dev machine.
I realized there was a slight 8 seconds delay between my local dev and the hosted server. Although very slim, it caused an iat error.
Thanks for the insight @pantharshit00 .
I also encountered the issue and had to use another time server on my development machine. Shouldn't this be fixed?
Same for me. This is kind of annoying, I can't doing anything on my development machine.
I am closing this. This is more related to a specific machine's time so we really can't do a fix for this. Anyone facing this will need to manually adjust their machine's time
Please open a new issue if you think strongly that this is bug in Prisma ecosystem and shouldn't be closed
I was able to fix this issue by restarting my docker machine. It seems like there should be some sort of network time synchronization built into the nodes though, as it's fairly common for different system clocks to be off by a few seconds. Older windows machines can be off by minutes.
If you are on macOS, just uncheck and check set date and time automatically in time settings. Worked for me.
You can also run the following command in macOS to sync time
sudo sntp -sS time.apple.com
hello fellas,
since we have this problem and clock synchronization solutions you propose do not cut it, I have opened Feature request issue #4878 , where I propose the possible feature which would solve this problem, which is very easy to implement. Please leave your comment or thumbs up within the issue, so that I know if my idea is correct.
Most helpful comment
I was able to fix this issue by restarting my docker machine. It seems like there should be some sort of network time synchronization built into the nodes though, as it's fairly common for different system clocks to be off by a few seconds. Older windows machines can be off by minutes.