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.

API.service.ts is not updated after schema.graphql changes in Angular App

See original GitHub issue

Describe the bug I am using AWS Amplify API with GraphQL and Appsync within an Angular 8 application.

After creating a new type in my schema.graphql file, my Amplify files (e.g. API.service.ts, mutations.ts, queries.ts, subscriptions.ts) are no longer updated.

To Reproduce Steps to reproduce the behavior:

  1. Update amplify/backend/api/YOURPROJECT/schema.graphql
  2. amplify push
  3. Affirm the update of existing graphql API and statements
  4. CLI provides feedback that everything worked fine, including the API.service.ts (“Code generated successfully and saved in file src/app/API.service.ts”)
  5. AppSync API is updated and DynamoDB ressources are correctly provided
  6. Queries and Mutations via AppSync Console work as expected
  7. Files in Angular project are not updated and I am not able to use the service for GraphQL operations

Expected behavior

  • GraphQL operations should be successfully generated and saved at src/graphql in my Angular project.
  • Code should be generated successfully and saved in file src/app/API.service.ts
Environment

System: OS: macOS Mojave 10.14.5 CPU: (8) x64 Intel® Core™ i5-8259U CPU @ 2.30GHz Memory: 63.90 MB / 8.00 GB Shell: 3.2.57 - /bin/bash Binaries: Node: 10.15.3 - /usr/local/bin/node npm: 6.11.3 - /usr/local/bin/npm Browsers: Chrome: 78.0.3904.87 Safari: 12.1.1 npmPackages: @angular-devkit/build-angular: ~0.803.4 => 0.803.4 @angular/animations: ~8.2.5 => 8.2.6 @angular/cdk: ~8.2.2 => 8.2.2 @angular/cli: ~8.3.4 => 8.3.4 @angular/common: ~8.2.5 => 8.2.6 @angular/compiler: ~8.2.5 => 8.2.6 @angular/compiler-cli: ~8.2.5 => 8.2.6 @angular/core: ~8.2.5 => 8.2.6 @angular/forms: ~8.2.5 => 8.2.6 @angular/language-service: ~8.2.5 => 8.2.6 @angular/material: ^8.2.2 => 8.2.2 @angular/platform-browser: ~8.2.5 => 8.2.6 @angular/platform-browser-dynamic: ~8.2.5 => 8.2.6 @angular/router: ~8.2.5 => 8.2.6 @ng-bootstrap/ng-bootstrap: ^5.1.2 => 5.1.2 @types/jasmine: ~3.3.8 => 3.3.16 @types/jasminewd2: ~2.0.3 => 2.0.6 @types/node: ~8.9.4 => 8.9.5 aws-amplify: ^1.2.4 => 1.2.4 aws-appsync: ^2.0.0 => 2.0.0 bootstrap: ^4.3.1 => 4.3.1 codelyzer: ^5.0.0 => 5.1.0 graphql: ^14.5.8 => 14.5.8 graphql-tag: ^2.10.1 => 2.10.1 hammerjs: ^2.0.8 => 2.0.8 ionicons: ^4.6.3 => 4.6.3 jasmine-core: ~3.4.0 => 3.4.0 jasmine-spec-reporter: ~4.2.1 => 4.2.1 karma: ~4.1.0 => 4.1.0 karma-chrome-launcher: ~2.2.0 => 2.2.0 karma-coverage-istanbul-reporter: ~2.0.1 => 2.0.6 karma-jasmine: ~2.0.1 => 2.0.1 karma-jasmine-html-reporter: ^1.4.0 => 1.4.2 protractor: ~5.4.0 => 5.4.2 rxjs: ^6.5.3 => 6.5.3 ts-node: ~7.0.0 => 7.0.1 tslib: ^1.10.0 => 1.10.0 tslint: ~5.15.0 => 5.15.0 typescript: ~3.5.3 => 3.5.3 uuid: ^3.3.3 => 3.3.3 zone.js: ~0.9.1 => 0.9.1 npmGlobalPackages: @angular/cli: 8.3.14 @aws-amplify/cli: 3.17.0 cordova: 9.0.0 create-react-app: 3.2.0 expo-cli: 3.4.1 firebase-tools: 7.3.2 ionic: 5.2.7 n: 4.1.0 npm: 6.11.3

Additional context My graphqlconfig.yml looks like this:

projects: wilson: schemaPath: src/graphql/schema.json includes: - src/graphql//*.ts excludes: - ./amplify/ extensions: amplify: codeGenTarget: angular generatedFileName: src/app/API.service.ts docsFilePath: src/graphql maxDepth: 6 extensions: amplify: version: 3

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
nikhnamecommented, Jan 8, 2020

@StevieWag which version of the CLI are you using? I was not able to reproduce this with version 4.11.0

If you run amplify api gql-compile and then amplify codegen is the API.service.ts updated? Please ensure that there are no syntax errors in your API.service.ts

0reactions
github-actions[bot]commented, May 24, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Angular AWS Amplify Graphql Query Not Returning Expected ...
I have managed to write a test query in the AWS AppSync Console, but I do not know how to replicate this in...
Read more >
Tutorial - Connect API and database to the app - Angular
The generated schema is for a Todo app. Replace the GraphQL schema at amplify/backend/api/RestaurantAPI/schema.graphql with the following:.
Read more >
GraphQL schema basics - Apollo GraphQL Docs
Your GraphQL server uses a schema to describe the shape of your available data. This schema defines a hierarchy of types with fields...
Read more >
Configuring an Angular CLI project with GraphQL - Medium
Run the script and verify a schema. graphql was created in the root of the project.
Read more >
Angular & Apollo Client: Getting Started with GraphQL in ...
Generate a new Angular application, and in the new Angular project, ... src/app/graphql/graphql-custom-backend.service.ts: schema: # where ...
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