question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Graphql validation error from generate scaffold [includes short-term work-around]

See original GitHub issue

ENVIRONMENT

0.1.0

PREPARATION

Created custom models, and ran yarn rw db save and yarn rw db up – success. Schema:

model User {
id          String @id @default(cuid())
name        String
email       String
wkspaces    Workspace[] @relation(name: "UserAsWorkspaceMember")
wkspaces_o  Workspace[] @relation(name: "UserAsWorkspaceOwner")
projects    Project[] @relation(name: "UserAsProjectMember")
projects_o  Project[] @relation(name: "UserAsProjectOwner")
createdAt   DateTime @default(now())
}

model Workspace {
id          String @id @default(cuid())
name        String
owner       User? @relation(name: "UserAsWorkspaceOwner")
users       User[] @relation(name: "UserAsWorkspaceMember")
createdAt   DateTime @default(now())
}

model Project {
id          String @id @default(cuid())
wkspace     Workspace @relation(name: "WorkspaceAsProjectContainer")
name        String
owner       User @relation(name: "UserAsProjectOwner")
users       User[] @relation(name: "UserAsProjectMember")
createdAt   DateTime @default(now())
}

Ran yarn rw g scaffold user and yarn rw g scaffold workspace and yarn rw g scaffold project – all ran (after I manually patched around the “scaffold.css already exists” problem).

OBSERVED PROBLEM

When I started the server via yarn rw dev, got this error trace repeatedly:

17:56:13 api |
17:56:13 api | /Users/chris/proj/aw-hammer/node_modules/graphql/type/validate.js:71
17:56:13 api |     throw new Error(errors.map(function (error) {
17:56:13 api |           ^
17:56:13 api | Error: The type of ProjectInput.wkspace must be Input Type but got: Workspace.
17:56:13 api |
17:56:13 api | The type of ProjectInput.owner must be Input Type but got: User.
17:56:13 api |
17:56:13 api | The type of ProjectInput.users must be Input Type but got: User.
17:56:13 api |
17:56:13 api | The type of UserInput.wkspaces must be Input Type but got: Workspace.
17:56:13 api |
17:56:13 api | The type of UserInput.wkspaces_o must be Input Type but got: Workspace.
17:56:13 api |
17:56:13 api | The type of UserInput.projects must be Input Type but got: Project.
17:56:13 api |
17:56:13 api | The type of UserInput.projects_o must be Input Type but got: Project.
17:56:13 api |
17:56:13 api | The type of WorkspaceInput.owner must be Input Type but got: User.
17:56:13 api |
17:56:13 api | The type of WorkspaceInput.users must be Input Type but got: User.
17:56:13 api |
17:56:13 api | The type of WorkspaceInput.projects must be Input Type but got: Project.
17:56:13 api |     at assertValidSchema (/Users/chris/proj/aw-hammer/node_modules/graphql/type/validate.js:71:11)
17:56:13 api |     at assertValidExecutionArguments (/Users/chris/proj/aw-hammer/node_modules/graphql/execution/execute.js:136:35)
17:56:13 api |     at executeImpl (/Users/chris/proj/aw-hammer/node_modules/graphql/execution/execute.js:86:3)
17:56:13 api |     at Object.execute (/Users/chris/proj/aw-hammer/node_modules/graphql/execution/execute.js:64:63)
17:56:13 api |     at Object.generateSchemaHash (/Users/chris/proj/aw-hammer/node_modules/apollo-server-core/src/utils/schemaHash.ts:11:18)
17:56:13 api |     at ApolloServer.generateSchemaDerivedData (/Users/chris/proj/aw-hammer/node_modules/apollo-server-core/src/ApolloServer.ts:496:24)
17:56:13 api |     at new ApolloServerBase (/Users/chris/proj/aw-hammer/node_modules/apollo-server-core/src/ApolloServer.ts:369:32)
17:56:13 api |     at new ApolloServer (/Users/chris/proj/aw-hammer/node_modules/apollo-server-lambda/src/ApolloServer.ts:38:5)
17:56:13 api |     at createGraphQLHandler (/Users/chris/proj/aw-hammer/node_modules/@redwoodjs/api/src/graphQLServer.ts:48:19)
17:56:13 api |     at Object.<anonymous> (/Users/chris/proj/aw-hammer/api/src/functions/graphql.js:37:47)
error Command failed with exit code 1.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
chris-hailstormcommented, Mar 11, 2020
2reactions
chris-hailstormcommented, Mar 11, 2020

I’m taking a look at a PR now, thanks for suggesting.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Experiencing Issue#192 on v0.1.0: `yarn rw g scaffold post` fails
Graphql validation error from generate scaffold [includes short-term work-around]. opened 10:11PM - 10 Mar 20 UTC. chris-hailstorm.
Read more >
Full Stack Error Handling with GraphQL and Apollo
If networkError is present in your response, it means your entire query was rejected, and therefore no data was returned. For example, the ......
Read more >
Advanced Sequence Topics | LoopBack Documentation
As a short-term workaround, controller methods are allowed to send the response directly, effectively bypassing send action. The default implementation of send ...
Read more >
A curated list of awesome Go frameworks, libraries and ...
A curated list of awesome Go / Golang frameworks, libraries and software.
Read more >
Top GraphQL Errors and How to fix them
Client side problems - Validation rules of GraphQL Query · malformed query · syntax or schema logic · variables and fragments not defined...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found