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.44k stars 2.13k forks source link

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

Closed lwang-79 closed 2 weeks ago

lwang-79 commented 4 weeks 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 4 weeks 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 4 weeks 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"
  }
}
chrisbonifacio commented 3 weeks ago

it looks like you are a bit behind on the package versions.

can you upgrade to the latest versions of @aws-amplify/backend and @aws-amplify/backend-cli?

also, after upgrading, please run the following command and confirm that the version output is 1.10.2.

npm list @aws-amplify/data-schema

if not, run the following command to update the package and re-run the above command to confirm.

npm update @aws-amplify/data-schema
chrisbonifacio commented 2 weeks ago

Hi 👋 Closing this as we have not heard back from you. If you are still experiencing this issue and in need of assistance, please feel free to comment and provide us with any information previously requested by our team members so we can re-open this issue and be better able to assist you.

Thank you!