Prisma1: Syntax Error: Expected Name, found }

Created on 12 Nov 2018  ยท  3Comments  ยท  Source: prisma/prisma1

Describe the bug
My datamodel.prisma file:

type Breed {
  id: ID! @unique
  animals: [Animal!]!
}

type Animal {
  id: ID! @unique
  name: String!
  breed: Breed!
}

Now,

$ yarn prisma deploy
yarn run v1.10.1
$ /Users/skainswo/dev/kumo/node-api/node_modules/.bin/prisma deploy
Deploying service `kumo` to stage `dev` to server `prisma-us1` 57ms
Service is already up to date.

post-deploy:

Generating schema... 30ms
 โ–ธ    Syntax Error: Expected Name, found }

Get in touch if you need help: https://www.prisma.io/forum/
To get more detailed output, run $ export DEBUG="*"
[email protected] alert: failed to send exception to sentry: connect ECONNREFUSED 0.0.0.0:443

Running prisma generate โœ–
โœจ  Done in 5.77s.

Running with DEBUG="*" doesn't really help:

$ DEBUG="*" yarn prisma deploy
yarn run v1.10.1
$ /Users/skainswo/dev/kumo/node-api/node_modules/.bin/prisma deploy
  config CWD /Users/skainswo/dev/kumo/node-api +0ms
  config HOME /Users/skainswo +2ms
  config definitionDir /Users/skainswo/dev/kumo/node-api +1ms
  config definitionPath /Users/skainswo/dev/kumo/node-api/prisma.yml +0ms
  cli { isGlobal: false } +0ms
  StatusChecker setting status checker +0ms
  cli command id deploy +6ms
  cli:plugincache Got plugin from cache +0ms
  cli:plugincache /Users/skainswo/Library/Caches/prisma/plugins.json +0ms
  cli:plugincache Got plugin from cache +1ms
  cli:plugincache /Users/skainswo/Library/Caches/prisma/plugins.json +0ms
  plugins findCommand prisma-cli-core +0ms
  plugin requiring command +0ms
  cli-engine:plugins:manager requiring /Users/skainswo/dev/kumo/node-api/node_modules/prisma-cli-core +0ms
  cli-engine:plugins:manager required +1s
  plugin required command +1s
  Environment saving global rc +0ms
  StatusChecker setting status checker +1s
  prisma definition making cluster here +0ms
  client Initializing cluster client +0ms
  deploy checking if project exists +0ms
  client Sending query to cluster prisma-us1 +249ms
  client https://us1.prisma.sh/management +0ms
  client
  client       query($name: String! $stage: String!) {
  client         project(name: $name stage: $stage) {
  client           name
  client           stage
  client         }
  client       }
  client      +0ms
  client { name: 'samuela-67d068~kumo', stage: 'dev' } +0ms
  client { project: { name: 'samuela-67d068~kumo', stage: 'dev' } } +54ms

Deploying service `kumo` to stage `dev` to server `prisma-us1`...  client Sending query to cluster prisma-us1 +3ms
  client https://us1.prisma.sh/management +0ms
  client       mutation($name: String!, $stage: String! $types: String! $dryRun: Boolean $secrets: [String!], $subscriptions: [FunctionInput!], $force: Boolean) {
  client         deploy(input: {
  client           name: $name
  client           stage: $stage
  client           types: $types
  client           dryRun: $dryRun
  client           secrets: $secrets
  client           subscriptions: $subscriptions
  client           force: $force
  client         }) {
  client           errors {
  client             type
  client             field
  client             description
  client           }
  client           warnings {
  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      +0ms
  client { name: 'samuela-67d068~kumo',
  client   stage: 'dev',
  client   types:
  client    '# These are the definitions for the ORM data model layer handled by Prisma.\n\n# type Build {\n#   id: ID! @unique\n#   createdAt: DateTime!\n#   updatedAt: DateTime!\n\n#   buildSteps: [BuildStep!]! @relation(name: "BuildBuildSteps", onDelete: CASCADE)\n# }\n\n# type BuildStep {\n#   id: ID! @unique\n#   createdAt: DateTime!\n#   updatedAt: DateTime!\n\n#   build: Build! @relation(name: "BuildBuildSteps")\n\n#   type: BuildStepType!\n#   messages: [BuildStepMessage!]! @relation(name: "BuildStepMessages", onDelete: CASCADE)\n#   completion: BuildStepCompletion @relation(name: "BuildStepCompletion", onDelete: CASCADE)\n# }\n\n# enum BuildStepType {\n#   GITPULL\n#   DOCKERBUILD\n#   DOCKERPUSH\n# }\n\n# type BuildStepMessage {\n#   id: ID! @unique\n#   createdAt: DateTime!\n#   updatedAt: DateTime!\n\n#   buildStep: BuildStep! @relation(name: "BuildStepMessages")\n\n#   # This is the local timestamp for ordering events.\n#   timestamp: Int!\n#   message: String!\n#   stream: StandardStream!\n# }\n\n# enum StandardStream {\n#   STDOUT\n#   STDERR\n# }\n\n# type BuildStepCompletion {\n#   id: ID! @unique\n#   createdAt: DateTime!\n#   updatedAt: DateTime!\n\n#   buildStep: BuildStep! @relation(name: "BuildStepCompletion")\n\n#   exitCode: Int!\n# }\n\ntype Breed {\n  id: ID! @unique\n  animals: [Animal!]!\n}\n\ntype Animal {\n  id: ID! @unique\n  name: String!\n  breed: Breed!\n}\n\n',
  client   dryRun: undefined,
  client   secrets: null,
  client   subscriptions: [],
  client   force: undefined } +10ms
  client { deploy: { errors: [], warnings: [], migration: null } } +89ms
 100ms
Service is already up to date.

post-deploy:

Running prisma generate...
2018-11-12T00:13:37.260Z config CWD /Users/skainswo/dev/kumo/node-api
2018-11-12T00:13:37.261Z config HOME /Users/skainswo
2018-11-12T00:13:37.262Z config definitionDir /Users/skainswo/dev/kumo/node-api
2018-11-12T00:13:37.262Z config definitionPath /Users/skainswo/dev/kumo/node-api/prisma.yml
2018-11-12T00:13:37.299Z cli { isGlobal: false }
2018-11-12T00:13:37.300Z StatusChecker setting status checker
2018-11-12T00:13:37.302Z cli command id generate
2018-11-12T00:13:37.308Z cli:plugincache Got plugin from cache
2018-11-12T00:13:37.308Z cli:plugincache /Users/skainswo/Library/Caches/prisma/plugins.json
2018-11-12T00:13:37.309Z cli:plugincache Got plugin from cache
2018-11-12T00:13:37.309Z cli:plugincache /Users/skainswo/Library/Caches/prisma/plugins.json
2018-11-12T00:13:37.310Z plugins findCommand prisma-cli-core
2018-11-12T00:13:37.310Z plugin requiring command
2018-11-12T00:13:37.311Z cli-engine:plugins:manager requiring /Users/skainswo/dev/kumo/node-api/node_modules/prisma-cli-core
2018-11-12T00:13:37.839Z cli-engine:plugins:manager required
2018-11-12T00:13:37.841Z plugin required command
2018-11-12T00:13:38.143Z Environment saving global rc
2018-11-12T00:13:38.163Z StatusChecker setting status checker

Generating schema... 30ms
Syntax Error: Expected Name, found }

GraphQL request (211:1)
210:
211: }
     ^
212:

    at syntaxError (/Users/skainswo/dev/kumo/node-api/node_modules/graphql/error/syntaxError.js:24:10)
    at expect (/Users/skainswo/dev/kumo/node-api/node_modules/graphql/language/parser.js:1463:32)
    at parseName (/Users/skainswo/dev/kumo/node-api/node_modules/graphql/language/parser.js:96:15)
    at parseInputValueDef (/Users/skainswo/dev/kumo/node-api/node_modules/graphql/language/parser.js:920:14)
    at many (/Users/skainswo/dev/kumo/node-api/node_modules/graphql/language/parser.js:1520:16)
    at parseInputFieldsDefinition (/Users/skainswo/dev/kumo/node-api/node_modules/graphql/language/parser.js:1083:50)
    at parseInputObjectTypeDefinition (/Users/skainswo/dev/kumo/node-api/node_modules/graphql/language/parser.js:1067:16)
    at parseTypeSystemDefinition (/Users/skainswo/dev/kumo/node-api/node_modules/graphql/language/parser.js:736:16)
    at parseDefinition (/Users/skainswo/dev/kumo/node-api/node_modules/graphql/language/parser.js:142:16)
    at many (/Users/skainswo/dev/kumo/node-api/node_modules/graphql/language/parser.js:1523:16)
    at parseDocument (/Users/skainswo/dev/kumo/node-api/node_modules/graphql/language/parser.js:113:18)
    at parse (/Users/skainswo/dev/kumo/node-api/node_modules/graphql/language/parser.js:48:10)
    at Object.buildSchema (/Users/skainswo/dev/kumo/node-api/node_modules/graphql/utilities/buildASTSchema.js:486:43)
    at GenereateCommand.<anonymous> (/Users/skainswo/dev/kumo/node-api/node_modules/prisma-cli-core/src/commands/generate/generate.ts:138:20)
    at step (/Users/skainswo/dev/kumo/node-api/node_modules/prisma-cli-core/dist/commands/generate/generate.js:42:23)
    at Object.next (/Users/skainswo/dev/kumo/node-api/node_modules/prisma-cli-core/dist/commands/generate/generate.js:23:53)
    at /Users/skainswo/dev/kumo/node-api/node_modules/prisma-cli-core/dist/commands/generate/generate.js:17:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/skainswo/dev/kumo/node-api/node_modules/prisma-cli-core/dist/commands/generate/generate.js:13:12)
    at GenereateCommand.generateTypescript (/Users/skainswo/dev/kumo/node-api/node_modules/prisma-cli-core/dist/commands/generate/generate.js:183:16)
    at GenereateCommand.<anonymous> (/Users/skainswo/dev/kumo/node-api/node_modules/prisma-cli-core/src/commands/generate/generate.ts:100:22)
    at step (/Users/skainswo/dev/kumo/node-api/node_modules/prisma-cli-core/dist/commands/generate/generate.js:42:23)
    at Object.next (/Users/skainswo/dev/kumo/node-api/node_modules/prisma-cli-core/dist/commands/generate/generate.js:23:53)
    at fulfilled (/Users/skainswo/dev/kumo/node-api/node_modules/prisma-cli-core/dist/commands/generate/generate.js:14:58)
[email protected] alert: failed to send exception to sentry: connect ECONNREFUSED 0.0.0.0:443
Exiting with code: 1

Running prisma generate... โœ–
  util timed out +0ms
Exiting with code: 0
โœจ  Done in 5.64s.

Expected behavior

  1. Useful syntax errors with line and column information.
  2. No syntax error in this particular case.

Versions (please complete the following information):

  • OS: macOS 10.14
  • prisma CLI: prisma/1.20.1 (darwin-x64) node-v10.11.0
  • Prisma Server: Prisma Cloud
$ yarn list | grep prisma
โ”œโ”€ [email protected]
โ”‚  โ”œโ”€ [email protected]
โ”‚  โ””โ”€ [email protected]
โ”‚     โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”‚  โ”œโ”€ graphql-config-extension-prisma@^0.2.3
โ”‚  โ”œโ”€ [email protected]
โ”‚  โ”œโ”€ [email protected]
โ”‚  โ”œโ”€ [email protected]
โ”‚  โ”œโ”€ [email protected]
โ”‚  โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”‚  โ”œโ”€ [email protected]
โ”‚  โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”‚  โ”œโ”€ [email protected]
โ”‚  โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”‚  โ”œโ”€ [email protected]
โ”œโ”€ [email protected]
โ”‚  โ”œโ”€ [email protected]
โ”‚  โ”œโ”€ [email protected]

Additional context
Looks like #1981 hasn't really been fixed. See also #3461 and #3382.

bu2-confirmed areclients areclient kinduplicate

All 3 comments

And

type Breed {
  id: ID! @unique
  animals: [Animal!]!
  dummy: Boolean
}

type Animal {
  id: ID! @unique
  name: String!
  breed: Breed!
}

works without issue.

Seems to be the same problem as described in #3452

Closing this in favor of #3452

Was this page helpful?
0 / 5 - 0 ratings

Related issues

marktani picture marktani  ยท  3Comments

schickling picture schickling  ยท  3Comments

schickling picture schickling  ยท  3Comments

jannone picture jannone  ยท  3Comments

hoodsy picture hoodsy  ยท  3Comments