Cannot import graphql autogenerated files
Describe the bug A clear and concise description of what the bug is. The graphql folder that is auto generated with queries, mutations and subscriptions cannot be imported to an angular project (angular 7). It throws module not found. Maybe is due to the fact that the generated file exports nothing. To Reproduce Steps to reproduce the behavior:
- amplify add api
- Try to import from graphql autogenerated modules
Expected behavior To be imported like every other module
@fatjoni Did you push API changes to the cloud? Also could you share the content in your <proj-root>/.graphqlconfig.yml. Please obfuscate sensitive information before sharing it
Here it is the .graphqlconfig.yml
projects:
carsApiDev:
schemaPath: src\graphql\schema.json
includes:
- src\graphql\**\*.graphql
excludes:
- ./amplify/**
extensions:
amplify:
codeGenTarget: angular
generatedFileName: src\app\API.service.ts
docsFilePath: src\graphql
Attached is the error, no matter what i try to import it shows module not found even though intelisense guides me to the specific path:
When i open for example the queries.graphql file i see there is no exported member and maybe this is the reason why this error is occurring.

@fatjoni do you see any error when you run amplfy codegen statements. Could you also try to change includes from src\graphql\**\*.graphql -> src/graphql/**/*.graphql and see if that changes anything
@yuth when i run amplify codegen statements i get the following: √ Downloaded the schema √ Generated GraphQL operations successfully and saved at src\graphql
I am using amplify 1.7.0 on a windows 10 machine
I am not sure i correctly understood your sugestion but if is about using backslashes i tried and it did not work.
@fatjoni could you share your schema or a sample schema where this can be reproduce this issue.
I noticed this happens when you generate mutations and queries in my project by selecting "angular" in cli. After i tried to select typescript it was fixed ^_^
@fatjoni choosing angular as codeGenTarget should not change how the statements are generated. Could you share a schmea where I can reproduce this
Closing this issue due to lack of customer response. Please feel free to re-open if you're still stuck on this.
I am having problems with this, this is not solved. It seems like a bug. currently I will just have to use dynamodb directly and by pass graphql.
I am also facing the same issue. I am facing an issue while doing an import same as @fatjoni. @fatjoni did you fix the issue? If so can you please tell me how?
I face the same issue. My schema looks like this:
type ParkEvent @model {
id: ID!
plate: String!
location: String!
startTimestamp: Int!
endTimestamp: Int
}
and the queries:
# this is an auto generated file. This will be overwritten
query GetParkEvent($id: ID!) {
getParkEvent(id: $id) {
id
plate
location
startTimestamp
endTimestamp
}
}
query ListParkEvents( $filter: ModelParkEventFilterInput $limit: Int $nextToken: String ) { listParkEvents(filter: $filter, limit: $limit, nextToken: $nextToken) { items { id plate location startTimestamp endTimestamp } nextToken } }
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help channels for those types of questions.