amplify-category-api
amplify-category-api copied to clipboard
Secondary index with two sort key fields is unpopulated
Before opening, please confirm:
- [X] I have installed the latest version of the Amplify CLI (see above), and confirmed that the issue still persists.
- [X] I have searched for duplicate or closed issues.
- [X] I have read the guide for submitting bug reports.
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
16.3.0
Amplify CLI Version
8.3.1
What operating system are you using?
Mac
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No
Amplify Categories
api
Amplify Commands
push
Describe the bug
Given a GraphQL schema like this:
type Invoice {
id: ID!
buyer_paidol_id: ID!
@index(
name: "byBuyerPaidol"
queryField: "invoicesByBuyerPaidol"
sortKeyFields: ["date"]
)
@index(
name: "byBuyerPaidolIdAndSupplierPaidolIdAndUserInvoiceId"
queryField: "invoicesByBuyerPaidolIdAndSupplierPaidolIdAndUserInvoiceId"
sortKeyFields: ["user_invoice_id", "supplier_paidol_id"]
)
supplier_paidol_id: ID!
user_invoice_id: String!
}
The first index, byBuyerPaidol
is populated and returns expected results in GQL. However, the second index, byBuyerPaidolIdAndSupplierPaidolIdAndUserInvoiceId
is not populated:
![image](https://user-images.githubusercontent.com/102251/170786766-cb52c90d-3527-440a-a75d-a248607e90e6.png)
Switching the order of sortKeyFields
has no effect.
Expected behavior
The index should be populated.
Reproduction steps
- Edit schema
- Push
GraphQL schema(s)
type Invoice
@model(subscriptions: { level: off })
@auth(rules: [{ allow: private, operations: [read] }]) {
id: ID!
id_base58: String
id_base58_short: String
payment_file_queue_id: ID
@index(
name: "byPaymentFileQueue"
queryField: "invoicesByPaymentFileQueue"
sortKeyFields: ["createdAt"]
)
payment_file: PaymentFileQueue
@hasOne(fields: ["payment_file_queue_id"])
@auth(
rules: [
{
allow: groups
groupsField: "buyer_paidol_id"
operations: [create, read, update, delete]
}
]
)
buyer_paidol_id: ID!
@index(
name: "byBuyerPaidol"
queryField: "invoicesByBuyerPaidol"
sortKeyFields: ["date"]
)
@index(
name: "byBuyerPaidolIdAndSupplierPaidolIdAndUserInvoiceId"
queryField: "invoicesByBuyerPaidolIdAndSupplierPaidolIdAndUserInvoiceId"
sortKeyFields: ["user_invoice_id", "supplier_paidol_id"]
)
paidol_vendor_id: ID!
paidol_vendor: PaidolVendor!
@hasOne(fields: ["paidol_vendor_id"])
@auth(
rules: [
{
allow: groups
groupsField: "buyer_paidol_id"
operations: [create, read, update, delete]
}
]
)
supplier_paidol_id: ID!
supplier_paidol: Paidol!
@hasOne(fields: ["supplier_paidol_id"])
@auth(
rules: [
{
allow: groups
groupsField: "buyer_paidol_id"
operations: [create, read, update, delete]
}
]
)
user_invoice_id: String!
@auth(
rules: [
{
allow: groups
groupsField: "buyer_paidol_id"
operations: [create, read, update, delete]
}
]
)
date: AWSDateTime!
@auth(
rules: [
{
allow: groups
groupsField: "buyer_paidol_id"
operations: [create, read, update, delete]
}
]
)
balance_due: Currency!
@auth(
rules: [
{
allow: groups
groupsField: "buyer_paidol_id"
operations: [create, read, update, delete]
}
]
)
createdAt: AWSDateTime!
transaction_id: String
@auth(
rules: [
{
allow: groups
groupsField: "buyer_paidol_id"
operations: [create, read, update, delete]
}
]
)
priority_payment_id: String
@auth(
rules: [
{
allow: groups
groupsField: "buyer_paidol_id"
operations: [create, read, update, delete]
}
]
)
priority_payment_status: String
@auth(
rules: [
{
allow: groups
groupsField: "buyer_paidol_id"
operations: [create, read, update, delete]
}
]
)
priority_payment_type: String
@auth(
rules: [
{
allow: groups
groupsField: "buyer_paidol_id"
operations: [create, read, update, delete]
}
]
)
priority_payment_date: AWSDateTime
@auth(
rules: [
{
allow: groups
groupsField: "buyer_paidol_id"
operations: [create, read, update, delete]
}
]
)
priority_payment_auth_message: String
@auth(
rules: [
{
allow: groups
groupsField: "buyer_paidol_id"
operations: [create, read, update, delete]
}
]
)
priority_response: String
@auth(
rules: [
{
allow: groups
groupsField: "buyer_paidol_id"
operations: [create, read, update, delete]
}
]
)
status: PaymentFileQueueStatusEnum!
@auth(
rules: [
{
allow: groups
groupsField: "buyer_paidol_id"
operations: [create, read, update, delete]
}
]
)
}
Log output
# Put your logs below this line
Additional information
No response