我已经使用Prisma服务作为数据库在Heroku中部署了Graphql Yoga Server,并且还已经在Heroku上部署了一个nextjs应用程序的前端。当我尝试使用prisma db连接执行向上插入操作时,无法说[GraphQL error]: Message: Your token is invalid. It might have expired or you might be using a token from a different project., Location: undefined, Path: undefined
。我在Prisma的Github问题上经历了类似的问题,找不到任何有用的东西。
prisma_db连接:
const db = new Prisma({
typeDefs: 'src/generated/prisma.graphql',
endpoint: process.env.PRISMA_ENDPOINT,
secret: process.env.PRISMA_SECRET,
debug: true,
});
prisma.yml:
endpoint: ${env:PRISMA_ENDPOINT}
datamodel: datamodel.prisma
secret: ${env:PRISMA_SECRET}
# disableAuth: true
hooks:
post-deploy:
- graphql get-schema -p prisma
我已经在Heroku配置变量中设置了PRISMA_ENDPOINT和PRISMA_SECRET。为了确保.yml文件和数据库连接具有相同的秘密令牌。我还设置了秘密令牌,使其相对简单一些,请考虑使用secret123
,以便也没有特殊字符。
整个错误:
2018-12-21T07:08:45.107583+00:00 app[web.1]: [GraphQL error]: Message: Your token is invalid. It might have expired or you might be using a token from a different project., Location: undefined, Path: undefined
2018-12-21T07:08:45.108037+00:00 app[web.1]: [Network error]: Error: Your token is invalid. It might have expired or you might be using a token from a different project.
2018-12-21T07:08:45.115464+00:00 app[web.1]: { Error: Your token is invalid. It might have expired or you might be using a token from a different project.
2018-12-21T07:08:45.115467+00:00 app[web.1]: at BatchedGraphQLClient.<anonymous> (/app/node_modules/http-link-dataloader/dist/src/BatchedGraphQLClient.js:69:35)
2018-12-21T07:08:45.115469+00:00 app[web.1]: at step (/app/node_modules/http-link-dataloader/dist/src/BatchedGraphQLClient.js:40:23)
2018-12-21T07:08:45.115471+00:00 app[web.1]: at Object.next (/app/node_modules/http-link-dataloader/dist/src/BatchedGraphQLClient.js:21:53)
2018-12-21T07:08:45.115472+00:00 app[web.1]: at fulfilled (/app/node_modules/http-link-dataloader/dist/src/BatchedGraphQLClient.js:12:58)
2018-12-21T07:08:45.115474+00:00 app[web.1]: at process._tickCallback (internal/process/next_tick.js:68:7)
2018-12-21T07:08:45.115476+00:00 app[web.1]: message:
2018-12-21T07:08:45.115478+00:00 app[web.1]: 'Your token is invalid. It might have expired or you might be using a token from a different project.',
2018-12-21T07:08:45.115480+00:00 app[web.1]: locations: [],
2018-12-21T07:08:45.115482+00:00 app[web.1]: path: [ 'upsertUser' ] }
有关信息:当我尝试从Prisma游乐场执行相同的upsert操作时,它工作正常。有人可以告诉我我要去哪里了吗?提前致谢。