Describe the bug
I built a React Native App and I am following the amplify docs to add owner authorization. I am using withAuthenticator to register and sign in users through AWS Cognito.
Adding an @auth rule to a model with multiple editors will throw a subscription Error :
DataStore - subscriptionError Connection failed: {"errors":[{"message":"Validation error of type MissingFieldArgument: Missing field argument editors @ 'onCreateDraft'"}]}
Having just one owner won't generate any errors.
To Reproduce
Steps to reproduce the behavior:
- Add @auth parameter to a graphQL model
type Draft @model
@auth(rules: [
{ allow: owner }
]) {
id: ID!
title: String!
content: String
owner: String
}
- Update @auth parameter with multiple editors
type Draft @model
@auth(rules: [
{ allow: owner, ownerField: "editors", operations: [update, read] }
]) {
id: ID!
title: String!
content: String
owner: String
editors: [String]
}
-
Run amplify update api , amplify push, npm run amplify-modelgem
-
Run the app locally and see the error (I am using a "GroceryList" model instead of "Draft"):

Expected behavior
I am expecting the app to run without errors
Code Snippet
type Product @model
@auth(rules: [
{ allow: owner },
]){
id: ID!
groceryList: GroceryList @connection(name: "GroceryListProducts")
name: String!
checked: Boolean!
unit: String!
quantity: Int!
category: String!
}
type GroceryList @model
@auth(rules: [
{ allow: owner, ownerField: "editors", operations: [update, read] },
]){
id: ID!
name: String!
description: String
products: [Product] @connection(name: "GroceryListProducts")
owner: String
editors: [String]
}
import React from "react";
import Amplify from "aws-amplify";
import config from "./aws-exports";
import { withAuthenticator } from "aws-amplify-react-native";
Amplify.configure({
...config,
Analytics: {
disabled: true,
},
});
const App = () => {
return (
....
);
};
export default withAuthenticator(App);
What is Configured?
Output of running npx envinfo --system --binaries --browsers --npmPackages --npmGlobalPackages
System:
OS: Windows 10 10.0.18362
CPU: (8) x64 Intel(R) Core(TM) i7-8565U CPU @ 1.80GHz
Memory: 5.38 GB / 15.78 GB
Binaries:
Node: 12.16.2 - C:\Program Files\nodejs\node.EXE
npm: 6.14.4 - C:\Program Files\nodejs\npm.CMD
Browsers:
Chrome: 86.0.4240.111
Edge: Spartan (44.18362.449.0)
Internet Explorer: 11.0.18362.1
npmPackages:
@babel/core: ~7.9.0 => 7.9.6
@iconify/icons-mdi: ^1.0.142 => 1.0.142
@iconify/react: ^1.1.3 => 1.1.3
@react-native-community/masked-view: 0.1.10 => 0.1.10
@react-native-community/netinfo: 5.9.6 => 5.9.6
@react-native-community/picker: 1.6.6 => 1.6.6
@react-navigation/bottom-tabs: ^5.9.1 => 5.9.1
@react-navigation/native: ^5.7.5 => 5.7.5
@react-navigation/stack: ^5.9.2 => 5.9.2
aws-amplify: ^3.3.2 => 3.3.2
aws-amplify-react-native: ^4.2.7 => 4.2.7
babel-polyfill: ^6.26.0 => 6.26.0
expo: ~39.0.2 => 39.0.3
expo-font: ^8.3.0 => 8.3.0
expo-splash-screen: ^0.6.2 => 0.6.2
expo-status-bar: ~1.0.2 => 1.0.2
ini: ^1.3.5 => 1.3.5
inquirer: ^6.5.1 => 6.5.2
jest: ^26.4.2 => 26.4.2
react: 16.13.1 => 16.13.1
react-dom: 16.13.1 => 16.13.1
react-native: https://github.com/expo/react-native/archive/sdk-39.0.2.tar.gz => 0.63.2
react-native-gesture-handler: ~1.7.0 => 1.7.0
react-native-reanimated: ~1.13.0 => 1.13.1
react-native-safe-area-context: 3.1.4 => 3.1.4
react-native-screens: ~2.10.1 => 2.10.1
react-native-web: ~0.13.12 => 0.13.14
react-redux: ^7.2.1 => 7.2.1
react-redux-loading-bar: ^5.0.0 => 5.0.0
react-test-renderer: ^16.13.1 => 16.13.1
redux: ^4.0.5 => 4.0.5
redux-thunk: ^2.3.0 => 2.3.0
npmGlobalPackages:
@aws-amplify/cli: 4.31.1
@ionic/cli: 6.7.0
bower: 1.8.8
create-react-native-app: 3.1.0
exp: 57.2.1
expo-cli: 3.27.12
express-generator: 4.16.1
gulp: 4.0.2
sequelize-cli: 6.1.0
serverless: 1.71.3
sharp-cli: 1.14.1
wscat: 4.0.0
Environment:
Describe the bug
I built a React Native App and I am following the amplify docs to add owner authorization. I am using
withAuthenticatorto register and sign in users through AWS Cognito.Adding an
@authrule to a model with multiple editors will throw a subscription Error :Having just one owner won't generate any errors.
To Reproduce
Steps to reproduce the behavior:
Run
amplify update api,amplify push,npm run amplify-modelgemRun the app locally and see the error (I am using a "GroceryList" model instead of "Draft"):

Expected behavior
I am expecting the app to run without errors
Code Snippet
What is Configured?
Output of running
npx envinfo --system --binaries --browsers --npmPackages --npmGlobalPackagesEnvironment: