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

Error: Type Query not found #33

Closed
marc-hughes opened this issue Oct 16, 2024 · 4 comments
Closed

Error: Type Query not found #33

marc-hughes opened this issue Oct 16, 2024 · 4 comments

Comments

@marc-hughes
Copy link

marc-hughes commented Oct 16, 2024

When running the command, I get a "Type Query not found" error after it adds the schema. Any guidance on next steps would be greatly appreciated.

neptune-for-graphql  
--input-graphdb-schema-neptune-endpoint XXX:8182  
--create-update-aws-pipeline  
--create-update-aws-pipeline-name xxx_api  
--output-resolver-query-https  
--create-update-aws-pipeline-neptune-IAM

Getting Neptune schema from endpoint: XXXX:8182
  Found node: xxxx
  ... many of these
  Found edge: XXX
  ... many of these  
Got nodes and edges via Neptune Summary API.
  Added property to node: SKILL_SUBCATEGORY property: name type: String
  ... many of these
  Found edge: XXX  direction: XXX -> YYY
  ... many of these
Execution time: 15.73 seconds

Inferencing GraphQL schema from graphDB schema
Pascal case is not applicable, duplicate names types.

Wrote GraphQL schema to file: ./output/xxx_api.schema.graphql
Wrote GraphQL schema to file: ./output/xxx_api.source.schema.graphql
Wrote Neptune schema to file: ./output/xxx_api.neptune.schema.json
Wrote Lambda resolver to file: ./output/output.resolver.graphql.js
Wrote Javascript resolver to file: ./output/xxx_api.resolver.graphql.js

Creating AWS pipeline resources

Check if the pipeline resources have been created
⚠ Pipeline does not exists.
Get Neptune Cluster Info
✔ Got Neptune Cluster Info
Create ZIP
✔ Created ZIP File: XXX
Create Lambda execution role
✔ Role ARN: arn:aws:iam::XXXX
✔ Attached AWSLambdaBasicExecutionRole to Lambda Role
✔ Neptune query policy ARN: arn:aws:iam::XXXX
✔ Attached Neptune Query Policy policies to Lambda Role
Create Lambda function
✔ Lambda Name: xxx_apiLambdaFunction ARN: arn:aws:lambda:usXXXX:function:xxx_apiLambdaFunction
Create AppSync API
✔ Lambda invocation policy ARN: arn:aws:iam::XXXX
✔ Lambda invocation role ARN: arn:aws:iam::XXXX
✔ Attached policy to role
✔ Created API id:  XXX name: xxx_apiAPI
✔ Created API key: XXX
✔ Created DataSource: xxx_apiDataSource
✔ Created Function: xxx_apiFunction
✔ Added schema
✖ Error creating resources: NotFoundException: Type Query not found
Rolling back resources.
✔ Deleted API id: XXX
✔ Lambda function deleted: xxx_apiLambdaFunction
✔ Detached policy: arn:aws:iam::XXXX-role/AWSLambdaBasicExecutionRole from role: xxx_apiLambdaExecutionRole
✔ Detached policy: arn:aws:iam::XXXX-role/AWSLambdaBasicExecutionRole from role: xxx_apiLambdaExecutionRole
✔ Deleted policy: arn:aws:iam::XXXX
✔ Deleted role: xxx_apiLambdaExecutionRole
✔ Detached policy: arn:aws:iam::XXXX from role: xxx_apiLambdaInvocationRole
✔ Deleted policy: arn:aws:iam::XXXX
✔ Deleted role: xxx_apiLambdaInvocationRole

Done
@andreachild
Copy link
Contributor

Hello @marc-hughes the error you are seeing could be a result of an issue with the generated graphQL schema. Can you provide the xxx_api.schema.graphql and xxx_api.source.schema.graphql with sensitive data redacted?

I just recently made changes in the main branch which outputs logs to a file (you can turn on verbose logging with --log-verbose). If you are willing to check out the source code in the main branch, package, and install, it could provide more insight into the error you are receiving.

@marc-hughes
Copy link
Author

The main branch outputs a log similar to the output above, but with this extra bit:

[2024-10-21 18:33:25] INFO: Uploading schema ...
[2024-10-21 18:33:31] INFO: Added schema
[2024-10-21 18:33:31] INFO: Attaching resolvers
[2024-10-21 18:33:31] ERROR: Error creating resources
{
    "name": "NotFoundException",
    "$fault": "client",
    "$metadata": {
        "httpStatusCode": 404,
        "requestId": "a0050a34-c80f-424e-ad34-737dbdcf835f",
        "cfId": "e014apha3eQRr3qDFefQ5yXUjT-WCdj3qNsQrSKdRFgmojkTGfnL4A==",
        "attempts": 1,
        "totalRetryDelay": 0
    }
}
[2024-10-21 18:33:31] ERROR: Rolling back resources.
[2024-10-21 18:33:31] INFO: Deleting AppSync API ...

I'm checking with the company if I can share the full schema, but I did take that schema, ran it through a graphql schema validator, and got this output:

Invalid GraphQL schema provided:
There can be only one type named "SKILL_SUBCATEGORY".

Field "SKILL_SUBCATEGORY._id" can only be defined once.

There can be only one type named "EMPLOYER".

Field "EMPLOYER._id" can only be defined once.

There can be only one type named "EMPLOYERInput".

In the schema, I do see some double-entries

type SKILL_SUBCATEGORY {
  _id: ID!
  name: String
  skillSKILL_SUBCATEGORYsIn(filter: SKILLInput, options: Options): [SKILL]
  skill_categoryCATEGORY_SUBCATEGORYIn: SKILL_CATEGORY
  SKILL_SUBCATEGORY: SKILL_SUBCATEGORY
  CATEGORY_SUBCATEGORY: CATEGORY_SUBCATEGORY
}

(a lot of stuff between these)

type SKILL_SUBCATEGORY {
  _id: ID!
}

Side note: Current main branch fails if the output folder doesn't exist. Previously it would create it.

@andreachild
Copy link
Contributor

Thanks for the information. I can take a look to see why the schema might have duplicate entries. I have also opened a quick PR to fix the output folder issue, thanks for pointing that out.

@marc-hughes
Copy link
Author

The problem ended up being we had a vertex and an edge that had the same label. Once that was removed, everything is working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants