altering datamodel.graphql breaks deploy
brandonmp opened this issue · comments
brandon commented
Trying to set up a demo repo for an unrelated bug, but hitting another bug in adding to the typescript advanced boilerplate schema.
versions:
prisma/1.2.8
bash on windows 10
node-v9.4.0
reproduce:
graphql create my-boilerplate --boilerplate typescript-advanced
- alter
datamodel.graphql
to this (adds 1 type and connects topost
:
type Tag {
id: ID! @unique
createdAt: DateTime!
updatedAt: DateTime!
posts: [Post!]!
}
type Post {
id: ID! @unique
createdAt: DateTime!
updatedAt: DateTime!
isPublished: Boolean! @default(value: "false")
title: String!
text: String!
author: User!
tags: Tag!
}
type User {
id: ID! @unique
email: String! @unique
password: String!
name: String!
posts: [Post!]!
}
- run
prisma deploy
should see this error. see below for DEBUG="*"
printout
$ prisma deploy
Deploying service `prisma-relations-issue` to stage `dev` on cluster `brandon/prisma-us1` 427ms
Changes:
Tag (Type)
+ Created type `Tag`
+ Created field `id` of type `GraphQLID!`
+ Created field `createdAt` of type `DateTime!`
+ Created field `updatedAt` of type `DateTime!`
+ Created field `posts` of type `[Relation!]!`
Post (Type)
+ Created field `tags` of type `Relation!`
PostToTag (Relation)
+ Created relation between Post and Tag
Applying changes 903ms
Your GraphQL database endpoint is live:
HTTP: https://us1.prisma.sh/brandon/prisma-relations-issue/dev
WS: wss://us1.prisma.sh/brandon/prisma-relations-issue/dev
Hooks:
Checking, if schema file changed !
▸ Syntax Error: Expected Name, found }
Get in touch if you need help: https://www.graph.cool/forum
To get more detailed output, run $ export DEBUG="*"
w/ DEBUG
:
$ DEBUG="*" prisma deploy
config CWD /mnt/c/Users/brand/code/prisma-relations-issue +0ms
config HOME /home/bmp +2ms
config definitionDir /mnt/c/Users/brand/code/prisma-relations-issue/database +7ms
config definitionPath /mnt/c/Users/brand/code/prisma-relations-issue/database/prisma.yml +0ms
cli { isGlobal: true } +0ms
StatusChecker setting status checker +0ms
cli command id deploy +4ms
cli:plugincache Got plugin from cache +0ms
cli:plugincache /home/bmp/.cache/prisma/plugins.json +0ms
cli:plugincache Got plugin from cache +1ms
cli:plugincache /home/bmp/.cache/prisma/plugins.json +1ms
plugins findCommand prisma-cli-core +0ms
plugin requiring command +0ms
cli-engine:plugins:manager requiring /home/bmp/.nvm/versions/node/v9.4.0/lib/node_modules/prisma/node_modules/prisma-cli-core +0ms
portfinder:defaultHosts exports._defaultHosts is: [ '0.0.0.0', '192.168.56.1', 'fe80::21df:b255:d69a:268c', '192.168.99.1', 'fe80::956b:1f9b:758b:cd04', '10.0.75.1', 'fe80::4521:6ac2:4f50:6749', '192.168.64.1', 'fe80::908:bf42:a885:13ec', '192.168.191.167', 'fe80::e5e1:5a5d:5080:b8ba', '127.0.0.1', '::1' ] +0ms
cli-engine:plugins:manager required +543ms
plugin required command +548ms
Environment [ 'prisma-eu1', 'prisma-us1' ] +0ms
Environment { 'prisma-eu1': 'https://eu1.prisma.sh',
Environment 'prisma-us1': 'https://us1.prisma.sh' } +0ms
StatusChecker setting status checker +967ms
deploy run +696ms
environment generateClusterToken https://api.cloud.prisma.sh +0ms
environment generated cluster token +234ms
client Token eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJncmFudHMiOlt7InRhcmdldCI6ImJyYW5kb25-cHJpc21hLXJlbGF0aW9ucy1pc3N1ZS8qIiwiYWN0aW9uIjoiKiJ9XSwiaWF0IjoxNTE5NDMwNjQyLCJleHAiOjE1MTk0MzEyNDJ9.VF66u4jiM8oPAmoCdJ_9Yp5i0crzPqRpEEiKkjtiObH-jTX1a5jBMlcKqzk5MxhBOpNRtO4JP5CUms0q13j-7KrKzSgUTP_-77fQRPHQ8nHobtxznSemm01xPAtCXTfC_cCu2DVl-tUyq3TozaCJ0CfDPA1mpE1LBP7gJ9xNLf83mLu0uDdQQ9RBinSvS-PP4Fj4i1ffivhn8vPXfZ52NS6_QtETOYqchsuM6M9e60m8BxTwAFXl30ISrrEIKCYbUEhIlA-ZMMin0m5Ovht72U0J7lHCDzBQ-2H2I4ADmlRuiIcgz-rBffklC_mlotElMmoNM9jzMI-hJj4_fVGCTg +0ms
client Sending query to cluster prisma-us1 +391ms
client https://us1.prisma.sh/cluster +3ms
client
client query($name: String! $stage: String!) {
client project(name: $name stage: $stage) {
client name
client stage
client }
client }
client +0ms
client { name: 'brandon~prisma-relations-issue', stage: 'dev' } +2ms
client { project: { name: 'brandon~prisma-relations-issue', stage: 'dev' } } +394ms
Deploying service `prisma-relations-issue` to stage `dev` on cluster `brandon/prisma-us1`... client Sending query to cluster prisma-us1 +3ms
client https://us1.prisma.sh/cluster +0ms
client mutation($name: String!, $stage: String! $types: String! $dryRun: Boolean $secrets: [String!], $subscriptions: [FunctionInput!]) {
client deploy(input: {
client name: $name
client stage: $stage
client types: $types
client dryRun: $dryRun
client secrets: $secrets
client subscriptions: $subscriptions
client }) {
client errors {
client type
client field
client description
client }
client migration {
client ...MigrationFragment
client }
client }
client }
client
client fragment MigrationFragment on Migration {
client revision
client steps {
client type
client __typename
client ... on CreateEnum {
client name
client ce_values: values
client }
client ... on CreateField {
client model
client name
client cf_typeName: typeName
client cf_isRequired: isRequired
client cf_isList: isList
client cf_isUnique: unique
client cf_relation: relation
client cf_defaultValue: default
client cf_enum: enum
client }
client ... on CreateModel {
client name
client }
client ... on CreateRelation {
client name
client leftModel
client rightModel
client }
client ... on DeleteEnum {
client name
client }
client ... on DeleteField {
client model
client name
client }
client ... on DeleteModel {
client name
client }
client ... on DeleteRelation {
client name
client }
client ... on UpdateEnum {
client name
client newName
client values
client }
client ... on UpdateField {
client model
client name
client newName
client typeName
client isRequired
client isList
client isUnique: unique
client relation
client default
client enum
client }
client ... on UpdateModel {
client name
client um_newName: newName
client }
client }
client }
client
client +1ms
client { name: 'brandon~prisma-relations-issue',
client stage: 'dev',
client types: 'type Tag {\n id: ID! @unique\n createdAt: DateTime!\n updatedAt: DateTime!\n posts: [Post!]!\n}\n\ntype Post {\n id: ID! @unique\n createdAt: DateTime!\n updatedAt: DateTime!\n isPublished: Boolean! @default(value: "false")\n title: String!\n text: String!\n author: User!\n tags: Tag!\n}\n\ntype User {\n id: ID! @unique\n email: String! @unique\n password: String!\n name: String!\n posts: [Post!]!\n}\n\n',
client dryRun: undefined,
client secrets: [ 'mysecret123' ],
client subscriptions: [] } +37ms
client { deploy: { errors: [], migration: null } } +398ms
438ms
Service is already up to date.
Hooks:
Checking, if schema file changed... client introspecting brandon~prisma-relations-issue dev eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJkYXRhIjp7InNlcnZpY2UiOiJwcmlzbWEtcmVsYXRpb25zLWlzc3VlQGRldiIsInJvbGVzIjpbImFkbWluIl19LCJpYXQiOjE1MTk0MzA2NDMsImV4cCI6MTUyMDAzNTQ0M30.Kvrkd2XHWYTTGMjRVwMdU9NB2utmwYyb5W5siOeZI68 +4ms
!
Syntax Error: Expected Name, found }
GraphQL request (562:1)
561:
562: }
^
563:
at syntaxError (/home/bmp/.nvm/versions/node/v9.4.0/lib/node_modules/prisma/node_modules/graphql/error/syntaxError.js:24:10)
at expect (/home/bmp/.nvm/versions/node/v9.4.0/lib/node_modules/prisma/node_modules/graphql/language/parser.js:1299:32)
at parseName (/home/bmp/.nvm/versions/node/v9.4.0/lib/node_modules/prisma/node_modules/graphql/language/parser.js:92:15)
at parseInputValueDef (/home/bmp/.nvm/versions/node/v9.4.0/lib/node_modules/prisma/node_modules/graphql/language/parser.js:842:14)
at many (/home/bmp/.nvm/versions/node/v9.4.0/lib/node_modules/prisma/node_modules/graphql/language/parser.js:1348:16)
at parseInputFieldsDefinition (/home/bmp/.nvm/versions/node/v9.4.0/lib/node_modules/prisma/node_modules/graphql/language/parser.js:992:50)
at parseInputObjectTypeDefinition (/home/bmp/.nvm/versions/node/v9.4.0/lib/node_modules/prisma/node_modules/graphql/language/parser.js:977:16)
at parseTypeSystemDefinition (/home/bmp/.nvm/versions/node/v9.4.0/lib/node_modules/prisma/node_modules/graphql/language/parser.js:671:16)
at parseDefinition (/home/bmp/.nvm/versions/node/v9.4.0/lib/node_modules/prisma/node_modules/graphql/language/parser.js:143:16)
at parseDocument (/home/bmp/.nvm/versions/node/v9.4.0/lib/node_modules/prisma/node_modules/graphql/language/parser.js:110:22)
at Object.parse (/home/bmp/.nvm/versions/node/v9.4.0/lib/node_modules/prisma/node_modules/graphql/language/parser.js:38:10)
at Object.<anonymous> (/home/bmp/.nvm/versions/node/v9.4.0/lib/node_modules/prisma/node_modules/prisma-cli-core/src/commands/deploy/printSchema.ts:30:20)
at step (/home/bmp/.nvm/versions/node/v9.4.0/lib/node_modules/prisma/node_modules/prisma-cli-core/dist/commands/deploy/printSchema.js:32:23)
at Object.next (/home/bmp/.nvm/versions/node/v9.4.0/lib/node_modules/prisma/node_modules/prisma-cli-core/dist/commands/deploy/printSchema.js:13:53)
at fulfilled (/home/bmp/.nvm/versions/node/v9.4.0/lib/node_modules/prisma/node_modules/prisma-cli-core/dist/commands/deploy/printSchema.js:4:58)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:160:7)
Exiting with code: 1
brandon commented
adding: when i remove tags: Tag
from Post
, it deploys fine. and, if I connect User
to Tag
(instead of Post
to Tag
, it works fine. ie:
type Tag {
id: ID! @unique
createdAt: DateTime!
updatedAt: DateTime!
posts: [Post!]!
}
type Post {
id: ID! @unique
createdAt: DateTime!
updatedAt: DateTime!
isPublished: Boolean! @default(value: "false")
title: String!
text: String!
author: User!
# tags: [Tag!]! # this breaks prisma deploy
}
type User {
id: ID! @unique
email: String! @unique
password: String!
name: String!
posts: [Post!]!
tags: [Tag!]!
}
Nilan Marktanner commented
Hey @brandonmp, thanks a lot for reporting this issue! I believe it is similar to this one. Let's continue the discussion there 🙂