aws-amplify / amplify-js

A declarative JavaScript library for application development using cloud services.
https://docs.amplify.aws/lib/q/platform/js
Apache License 2.0
9.43k stars 2.12k forks source link

Unable to use "between" for multiple sort keys #13951

Open lwang-79 opened 1 day ago

lwang-79 commented 1 day ago

Before opening, please confirm:

JavaScript Framework

Next.js

Amplify APIs

GraphQL API

Amplify Version

v6

Amplify Categories

api

Backend

Amplify Gen 2

Environment information

``` # Put output below this line System: OS: macOS 15.0.1 CPU: (10) arm64 Apple M1 Pro Memory: 71.03 MB / 32.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 22.9.0 - /opt/homebrew/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 10.8.3 - /opt/homebrew/bin/npm Browsers: Chrome: 130.0.6723.59 Safari: 18.0.1 npmGlobalPackages: @aws-amplify/cli: 11.0.3 @types/node: 18.7.4 @ziglang/cli: 0.0.12 aws-cdk: 2.131.0 npm-check-updates: 17.1.2 npm: 10.8.3 nx: 19.8.3 ts-node: 10.9.1 typescript: 4.8.4 yarn: 1.22.19 ```

Describe the bug

I have a model "Job" wich has a GSI with 3 sort keys "datetime", "status", "type". When I try to query the data between tow datetime, I can't find a way to write the code. The "between" operator only accepts one itme in the array.

image image

Expected behavior

The "between" operator can accept tow items.

Reproduction steps

  1. create a model with GSI similar to "index('instructorId').sortKeys(['datetime', 'status', 'type'])"
  2. try to query the data between tow datetime.

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

chrisbonifacio commented 21 hours ago

Hi @lwang-79 can you please provide more information about the project's environment, such as the package.json file and dependencies listed in it?

lwang-79 commented 13 hours ago

Hi @chrisbonifacio, thank you for checking this. Here is my package.json

{
  "name": "next-driving",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@aws-amplify/geo": "^3.0.52",
    "@chakra-ui/icons": "^2.1.1",
    "@chakra-ui/next-js": "^2.2.0",
    "@chakra-ui/react": "^2.8.2",
    "@emotion/react": "^11.13.3",
    "@emotion/styled": "^11.13.0",
    "aws-amplify": "^6.6.2",
    "framer-motion": "^11.5.6",
    "next": "^14.2.14",
    "react": "^18",
    "react-dom": "^18",
    "react-slick": "^0.30.2",
    "react-webcam": "^7.2.0"
  },
  "devDependencies": {
    "@aws-amplify/backend": "^1.3.0",
    "@aws-amplify/backend-cli": "^1.2.8",
    "@types/node": "^22",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "@types/react-slick": "^0.23.13",
    "aws-cdk": "^2.159.1",
    "aws-cdk-lib": "^2.159.1",
    "constructs": "^10.3.0",
    "esbuild": "^0.23.1",
    "tsx": "^4.19.1",
    "typescript": "^5.6.2"
  }
}