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

initializeModel function breaks accumulator return type #13958

Closed
3 tasks done
WojciechKasprzyk opened this issue Oct 25, 2024 · 2 comments
Closed
3 tasks done

initializeModel function breaks accumulator return type #13958

WojciechKasprzyk opened this issue Oct 25, 2024 · 2 comments
Assignees
Labels
bug Something isn't working GraphQL Related to GraphQL API issues

Comments

@WojciechKasprzyk
Copy link

WojciechKasprzyk commented Oct 25, 2024

Before opening, please confirm:

JavaScript Framework

Angular

Amplify APIs

GraphQL API

Amplify Version

v6

Amplify Categories

api

Backend

Amplify Gen 2

Environment information

  System:
    OS: macOS 14.6.1
    CPU: (10) arm64 Apple M1 Pro
    Memory: 58.59 MB / 16.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.2.0 - /usr/local/bin/node
    npm: 10.7.0 - /usr/local/bin/npm
    bun: 1.0.0 - ~/.bun/bin/bun
  Browsers:
    Chrome: 130.0.6723.70
    Safari: 17.6
    Safari Technology Preview: 18.0
  npmPackages:
    @angular-devkit/build-angular: ^18.2.1 => 18.2.1 
    @angular-slider/ngx-slider: 18.0.0 => 18.0.0 
    @angular/animations: ^18.2.1 => 18.2.1 
    @angular/cli: ^18.2.1 => 18.2.1 
    @angular/common: ^18.2.1 => 18.2.1 
    @angular/compiler: ^18.2.1 => 18.2.1 
    @angular/compiler-cli: ^18.2.1 => 18.2.1 
    @angular/core: ^18.2.1 => 18.2.1 
    @angular/forms: ^18.2.1 => 18.2.1 
    @angular/platform-browser: ^18.2.1 => 18.2.1 
    @angular/platform-browser-dynamic: ^18.2.1 => 18.2.1 
    @angular/router: ^18.2.1 => 18.2.1 
    @aws-amplify/backend: ^1.1.1 => 1.1.1 
    @aws-amplify/backend-cli: ^1.2.5 => 1.2.5 
    @aws-amplify/ui-angular: ^5.0.19 => 5.0.28 
    @ngrx/effects: ^18.0.2 => 18.0.2 
    @ngrx/entity: ^18.0.2 => 18.0.2 
    @ngrx/eslint-plugin: ^18.0.2 => 18.0.2 
    @ngrx/operators: ^18.0.2 => 18.0.2 (18.0.1)
    @ngrx/schematics: ^18.0.2 => 18.0.2 
    @ngrx/store: ^18.0.2 => 18.0.2 
    @ngrx/store-devtools: ^18.0.2 => 18.0.2 
    @types/jasmine: ~5.1.4 => 5.1.4 
    aws-amplify: ^6.6.3 => 6.6.3 
    aws-amplify/adapter-core:  undefined ()
    aws-amplify/analytics:  undefined ()
    aws-amplify/analytics/kinesis:  undefined ()
    aws-amplify/analytics/kinesis-firehose:  undefined ()
    aws-amplify/analytics/personalize:  undefined ()
    aws-amplify/analytics/pinpoint:  undefined ()
    aws-amplify/api:  undefined ()
    aws-amplify/api/server:  undefined ()
    aws-amplify/auth:  undefined ()
    aws-amplify/auth/cognito:  undefined ()
    aws-amplify/auth/cognito/server:  undefined ()
    aws-amplify/auth/enable-oauth-listener:  undefined ()
    aws-amplify/auth/server:  undefined ()
    aws-amplify/data:  undefined ()
    aws-amplify/data/server:  undefined ()
    aws-amplify/datastore:  undefined ()
    aws-amplify/in-app-messaging:  undefined ()
    aws-amplify/in-app-messaging/pinpoint:  undefined ()
    aws-amplify/push-notifications:  undefined ()
    aws-amplify/push-notifications/pinpoint:  undefined ()
    aws-amplify/storage:  undefined ()
    aws-amplify/storage/s3:  undefined ()
    aws-amplify/storage/s3/server:  undefined ()
    aws-amplify/storage/server:  undefined ()
    aws-amplify/utils:  undefined ()
    bootstrap: ^5.3.3 => 5.3.3 
    jasmine-core: ~5.2.0 => 5.2.0 (4.6.1)
    karma: ~6.4.4 => 6.4.4 
    karma-chrome-launcher: ~3.2.0 => 3.2.0 
    karma-coverage: ~2.2.1 => 2.2.1 
    karma-coverage-coffee-example:  1.0.0 
    karma-jasmine: ~5.1.0 => 5.1.0 
    karma-jasmine-html-reporter: ~2.1.0 => 2.1.0 
    ngx-toastr: ^19.0.0 => 19.0.0 
    rxjs: ~7.8.1 => 7.8.1 
    rxjs/ajax:  undefined ()
    rxjs/fetch:  undefined ()
    rxjs/operators:  undefined ()
    rxjs/testing:  undefined ()
    rxjs/webSocket:  undefined ()
    swiper: ^10.3.1 => 10.3.1 
    tslib: ^2.7.0 => 2.7.0 (2.6.3, 2.0.3, 2.4.1, 2.2.0, 2.3.1, 1.14.1)
    typescript: ~5.5.4 => 5.5.4 (4.4.4, 4.9.5)
    zone.js: ~0.14.10 => 0.14.10 
  npmGlobalPackages:
    @angular/cli: 18.2.6
    @aws-amplify/cli: 12.12.4
    @ionic/cli: 7.2.0
    cordova-res: 0.15.4
    cordova: 12.0.0
    corepack: 0.28.1
    jest: 29.7.0
    n: 9.2.3
    npm: 10.7.0
    ts-node: 10.9.2



Describe the bug

I found a bug in your codebase in initializeModel function - the reduce there returns property value instead of accumulator reference which causes an error in the second iteration.

  1. First iteration
image
  1. Second Iteration
image

Expected behavior

sortKeyValues reduce should return acc instead of one of its field value

if (record[curVal]) {
   acc[curVal] = record[curVal];
}
return acc;

Reproduction steps

Call initializeModel function

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line


aws-exports.js

No response

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

No response

@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending a response from the Amplify team. labels Oct 25, 2024
@HuiSF HuiSF added the GraphQL Related to GraphQL API issues label Oct 25, 2024
@chrisbonifacio chrisbonifacio added bug Something isn't working and removed pending-triage Issue is pending triage labels Oct 29, 2024
@chrisbonifacio chrisbonifacio self-assigned this Oct 29, 2024
@chrisbonifacio chrisbonifacio removed the pending-maintainer-response Issue is pending a response from the Amplify team. label Oct 29, 2024
@chrisbonifacio
Copy link
Member

Hi @WojciechKasprzyk thank you for opening this issue. I've marked it as a bug for the team to investigate.

@zxl629
Copy link

zxl629 commented Nov 20, 2024

Hi @WojciechKasprzyk,

Thank you for bringing up this issue! A new version of the package (@aws-amplify/data-schema version 1.16.0) was released and the accumulator return type has been fixed.

Thanks,
Jack

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working GraphQL Related to GraphQL API issues
Projects
None yet
Development

No branches or pull requests

5 participants