Skip to content

Amplify mock doesn't list owner field when have multiple owners #14537

@Phok7

Description

@Phok7

Before opening, please confirm:

JavaScript Framework

Angular

Amplify APIs

GraphQL API, Authentication

Amplify Version

v6

Amplify Categories

auth, api

Backend

Amplify CLI

Environment information

System:
    OS: Linux 5.15 Ubuntu 22.04.5 LTS 22.04.5 LTS (Jammy Jellyfish)
    CPU: (12) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz
    Memory: 14.68 GB / 31.18 GB
    Container: Yes
    Shell: 3.3.1 - /usr/bin/fish
  Binaries:
    Node: 18.13.0 - ~/.nvm/versions/node/v18.13.0/bin/node
    npm: 8.19.3 - ~/.nvm/versions/node/v18.13.0/bin/npm
  Browsers:
    Chrome: 139.0.7258.127
  npmPackages:
    @angular-devkit/build-angular: ^17.0.1 => 17.3.5 
    @angular/animations: ^17.0.0 => 17.3.5 
    @angular/cdk: ^17.0.1 => 17.3.5 
    @angular/cli: ^17.0.1 => 17.3.5 
    @angular/common: ^17.0.0 => 17.3.5 
    @angular/compiler: ^17.0.0 => 17.3.5 
    @angular/compiler-cli: ^17.0.0 => 17.3.5 
    @angular/core: ^17.0.0 => 17.3.5 
    @angular/forms: ^17.0.0 => 17.3.5 
    @angular/localize: ^17.3.5 => 17.3.5 
    @angular/material: ^17.0.1 => 17.3.5 
    @angular/material-moment-adapter: ^17.2.0 => 17.3.5 
    @angular/platform-browser: ^17.0.0 => 17.3.5 
    @angular/platform-browser-dynamic: ^17.0.0 => 17.3.5 
    @angular/router: ^17.0.0 => 17.3.5 
    @angular/service-worker: ^17.0.0 => 17.3.5 
    @aws-amplify/cli-extensibility-helper: ^3.0.34 => 3.0.34 
    @aws-amplify/pubsub: ^6.0.5 => 6.0.27 
    @aws-amplify/ui-angular: ^5.0.1 => 5.0.13 
    @aws-sdk/client-bedrock-agent-runtime: ^3.658.1 => 3.658.1 
    @aws-sdk/client-bedrock-runtime: ^3.658.1 => 3.658.1 
    @types/d3: ^7.4.3 => 7.4.3 
    @types/file-saver: ^2.0.7 => 2.0.7 
    @types/jasmine: ~5.1.0 => 5.1.4 
    @types/leaflet: ^1.9.8 => 1.9.11 
    aws-amplify: ^6.0.3 => 6.0.28 
    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.2 => 5.3.3 
    concurrently: ^8.2.2 => 8.2.2 
    d3: ^7.8.5 => 7.9.0 
    file-saver: ^2.0.5 => 2.0.5 
    http-server: ^14.1.1 => 14.1.1 
    jasmine-core: ~5.1.0 => 5.1.2 (4.6.0)
    karma: ~6.4.0 => 6.4.3 
    karma-chrome-launcher: ~3.2.0 => 3.2.0 
    karma-coverage: ~2.2.0 => 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 
    leaflet: ^1.9.4 => 1.9.4 
    moment: ^2.29.4 => 2.30.1 
    rxjs: ~7.8.0 => 7.8.1 (6.6.7)
    rxjs/ajax:  undefined ()
    rxjs/fetch:  undefined ()
    rxjs/internal-compatibility:  undefined ()
    rxjs/operators:  undefined ()
    rxjs/testing:  undefined ()
    rxjs/webSocket:  undefined ()
    tslib: ^2.3.0 => 2.6.2 (1.14.1)
    typescript: ~5.2.2 => 5.2.2 (4.4.4)
    xlsx: ^0.18.5 => 0.18.5 
    zone.js: ~0.14.2 => 0.14.4 
  npmGlobalPackages:
    @angular/cli: 17.0.1
    @aws-amplify/cli: 12.14.1
    corepack: 0.15.2
    dynamodb-admin: 5.1.3
    npm-check-updates: 16.14.6
    npm: 8.19.3
    remotedebug-ios-webkit-adapter: 0.4.2
    sharp: 0.33.5


Describe the bug

Hello.

I have an Amplify Gen 1 app mocked in local with a GraphQL entity like this:

type Field @model @auth(rules: [
  { allow: owner, operations: [read], ownerField: "User" },
  { allow: groups, groups: ["Admins"] },
  { allow: private, provider: iam }
  ]){
  id: ID! @primaryKey
  Name: String
  Latitude: String
  Longitude: String
  Altitude: String
  User: [String]
}

The User field is used as owner field and is an Array of strings like says in the docs.

If I add or update some user in the entity like this:

mutation updateField {
  updateField(
    input: {id: "6795f7ac-23cd-4e9d-b63c-9d798e9823c2", User: ["xxxxxxxxxx-decc-47b5-8575-873fc85087ca::xxxxxxxxxx-decc-47b5-8575-873fc85087ca"]}
  ) {
    id
    Name
    User
  }
}

The user is added or updated fine in the local DynamoDB but when I try to get it from the api with:

query MyQuery {
  listFields {
    items {
      id
      Name
      User
    }
  }
}

The results is null:

{
  "data": {
    "listFields": {
      "items": [
        {
          "id": "xxxxxxxxxx-23cd-4e9d-b63c-9d798e9823c2",
          "Name": "Test 1",
          "User": null
        },
        {
          "id": "xxxxxxxxxx-f9c6-4f94-9dd9-870e81433085",
          "Name": "Test 2",
          "User": null
        }
      ]
    }
  }
}

In the prod enviroment works fine, but when I mock the app in local it's broke.

The GrapiQL auth options are fine and works right when I do some other function.

Can someone help with this?

Thanks!

Expected behavior

The api should return the User owner array.

Reproduction steps

The above steps works to reproduce.

Code Snippet

// Put your code below this line.

Log output

// Put your logs below this line


aws-exports.js

/* eslint-disable */
// WARNING: DO NOT EDIT. This file is automatically generated by AWS Amplify. It will be overwritten.

const awsmobile = {
    "aws_project_region": "us-east-1",
    "aws_appsync_graphqlEndpoint": "http://127.0.0.1:20002/graphql",
    "aws_appsync_region": "us-east-1",
    "aws_appsync_authenticationType": "AMAZON_COGNITO_USER_POOLS",
    "aws_appsync_dangerously_connect_to_http_endpoint_for_testing": true,
    "aws_cognito_identity_pool_id": "us-east-1:xxxxxxxxxxxxxxxxxxxx",
    "aws_cognito_region": "us-east-1",
    "aws_user_pools_id": "us-east-1_xxxxxxxxxxxxxxx",
    "aws_user_pools_web_client_id": "xxxxxxxxxxxxxxxxxxxxxxxxx",
    "oauth": {},
    "aws_cognito_username_attributes": [
        "EMAIL"
    ],
    "aws_cognito_social_providers": [],
    "aws_cognito_signup_attributes": [
        "EMAIL"
    ],
    "aws_cognito_mfa_configuration": "OFF",
    "aws_cognito_mfa_types": [
        "SMS"
    ],
    "aws_cognito_password_protection_settings": {
        "passwordPolicyMinLength": 8,
        "passwordPolicyCharacters": []
    },
    "aws_cognito_verification_mechanisms": [
        "EMAIL"
    ]
};


export default awsmobile;

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions