Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project 'default' not found #1123

Closed
sol-idsnake opened this issue May 2, 2020 · 6 comments
Closed

Project 'default' not found #1123

sol-idsnake opened this issue May 2, 2020 · 6 comments
Labels
released This issue or pull request is published

Comments

@sol-idsnake
Copy link

sol-idsnake commented May 2, 2020

Describe the bug
I followed the migration guide found in your repo here: Here and Here.
After that, my .graphqlrc.yml looks like this:

projects:
  app:
    schema: src/schema.graphql
  prisma:
    schema: /prisma.yml
    extensions:
      codegen:
        src/generated/prisma.graphql:
          - schema-ast

My prisma.yml:

endpoint: https://eu1.prisma.sh/Xxx/oldprisma/dev
datamodel: datamodel.prisma
# Ensures Prisma client is re-generated after a datamodel change.
hooks:
  post-deploy:
    - graphql codegen --project prisma # instead of graphql get-schema
    - prisma generate

My package.json script:
"gen": "graphql codegen --project prisma"

When I run npm run gen, I get × Project 'default' not found, and that's where it ends. I can't figure out how to fix it.

package.json:

"dependencies": {
		"@graphql-codegen/schema-ast": "^1.13.4",
		"@test-graphql-cli/codegen": "^4.0.1-beta.6",
		"graphql": "^14.5.8",
		"graphql-cli": "^4.0.1-beta.6",
		"graphql-yoga": "^1.18.3",
		"prisma": "^1.34.10",
		"prisma-binding": "^2.3.16"
	},

To Reproduce
Follow the above.

Expected behavior
Generate a prisma.graphql file.

Versions (please complete the following information):

  • OS: Windows 10
@snly2386
Copy link

snly2386 commented May 7, 2020

I'm having the exact same issue - although on mac os

@haohanqi
Copy link

haohanqi commented May 7, 2020

Me too. I am trying to update old .graphqlrc.yml to new one. Has same problem,

@sthomas1618
Copy link

Me too. You can get around it by specifying a default project. But then graphql codegen --project <project> always uses the default project.

@sthomas1618
Copy link

sthomas1618 commented May 12, 2020

Based on this thread from commander, it appears the parent command prevents the subcommand from sharing any common arguments, in this case project.

I got this working by adding cliFlags.project = cliFlags.parent.project to codegen/src/index.ts:

setCommandOptions(program.command('codegen') as any)
      .action(async (cliFlags: any) => {
         cliFlags.project = cliFlags.parent.project
         ....

Although this feels wrong and I'm not sure if this is best way to fix this problem.

@wtrocki
Copy link
Collaborator

wtrocki commented May 12, 2020

#1128 will fix this problem

@kamilkisiela
Copy link
Collaborator

4.0.0 should fix it

@kamilkisiela kamilkisiela added the released This issue or pull request is published label Jun 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released This issue or pull request is published
Projects
None yet
Development

No branches or pull requests

6 participants