Skip to content

The data GSI create mismatch variable name #3267

Description

@josephorng

Environment information

System:
  OS: Windows 10 10.0.19045
  CPU: (16) x64 11th Gen Intel(R) Core(TM) i9-11900 @ 2.50GHz
  Memory: 3.37 GB / 15.77 GB
Binaries:
  Node: 22.23.1 - C:\Program Files\nodejs\node.EXE
  Yarn: 1.22.22 - ~\AppData\Roaming\npm\yarn.CMD
  npm: 10.9.8 - C:\Program Files\nodejs\npm.CMD
  pnpm: undefined - undefined
NPM Packages:
  @aws-amplify/auth-construct: 1.11.2
  @aws-amplify/backend: 1.23.0
  @aws-amplify/backend-ai: Not Found
  @aws-amplify/backend-auth: 1.9.4
  @aws-amplify/backend-cli: 1.8.3
  @aws-amplify/backend-data: 1.7.0
  @aws-amplify/backend-deployer: 2.1.7
  @aws-amplify/backend-function: 1.18.1
  @aws-amplify/backend-output-storage: 1.3.5
  @aws-amplify/backend-secret: 1.4.2
  @aws-amplify/backend-storage: 1.5.0
  @aws-amplify/cli-core: 2.2.5
  @aws-amplify/client-config: 1.10.2
  @aws-amplify/data-construct: 1.17.4
  @aws-amplify/data-schema: 1.21.0
  @aws-amplify/deployed-backend-client: 1.8.2
  @aws-amplify/form-generator: 1.2.7
  @aws-amplify/model-generator: 1.2.3
  @aws-amplify/platform-core: 1.11.1
  @aws-amplify/plugin-types: 1.12.1
  @aws-amplify/sandbox: 2.2.1
  @aws-amplify/schema-generator: 1.4.0
  @aws-cdk/toolkit-lib: 1.19.0
  aws-amplify: 6.18.0
  aws-cdk-lib: 2.261.0
  typescript: 5.9.3
No AWS environment variables
No CDK environment variables

Describe the bug

It seems that the gsi for data create mismatch variable type name:
Validation error of type VariableTypeMismatch: Variable type 'ModelUserPrivateSyncItemFilterInput' doesn't match expected type 'ModeluserPrivateSyncItemFilterInput' @ 'userPrivateSyncItemsByDataType'

Reproduction steps

Create a datatype like this

`

userPrivateSyncItem: a
  .model({
    sub: a.string().required(),
    dataType: a.string().required(),
    itemKey: a.string().required(),
    learnerId: a.string().required(),
    lastRead: a.integer(),
    lastModified: a.integer().required(),
    createdAt: a.integer(),
    deleted: a.boolean().default(false),
    data: a.json().required(),
  })
  .identifier(["sub", "dataType", "itemKey"])
  .secondaryIndexes((index) => [
    index("dataType").queryField("userPrivateSyncItemsByDataType"),
  ])
  .authorization((allow) => [
    allow.ownerDefinedIn("sub").to(["create", "read", "update", "delete"]),
  ]),

`

and when I run this code:

`

const page = (await client.models.userPrivateSyncItem.userPrivateSyncItemsByDataType({
  dataType: dataType,
}, { nextToken })) as ListPage;

`

I get this error:

Validation error of type VariableTypeMismatch: Variable type 'ModelUserPrivateSyncItemFilterInput' doesn't match expected type 'ModeluserPrivateSyncItemFilterInput' @ 'userPrivateSyncItemsByDataType'

Metadata

Metadata

Assignees

No one assigned

    Labels

    pending-triageIncoming issues that need categorization

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions