Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught (in promise) Error: Invalid predicate. Terminate your predicate with a valid condition #13896

Open
3 tasks done
djom202 opened this issue Oct 8, 2024 · 0 comments
Open
3 tasks done
Labels
DataStore Related to DataStore category pending-maintainer-response Issue is pending a response from the Amplify team. pending-triage Issue is pending triage

Comments

@djom202
Copy link

djom202 commented Oct 8, 2024

Before opening, please confirm:

JavaScript Framework

Vue

Amplify APIs

DataStore

Amplify Version

v5

Amplify Categories

storage

Backend

Amplify CLI

Environment information

# Put output below this line

  System:
    OS: macOS 14.5
    CPU: (8) x64 Intel(R) Core(TM) i5-8257U CPU @ 1.40GHz
    Memory: 180.05 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.12.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.7.0 - /usr/local/bin/npm
  Browsers:
    Brave Browser: 106.1.44.108
    Chrome: 129.0.6668.90
    Safari: 17.5
  npmPackages:
    @aws-amplify/datastore: ^4.7.4 => 4.7.4 
    @bootstrap-vue/alert:  1.0.0 
    @bootstrap-vue/aspect:  1.0.0 
    @bootstrap-vue/avatar:  1.0.0 
    @bootstrap-vue/badge:  1.0.0 
    @bootstrap-vue/breadcrumb:  1.0.0 
    @bootstrap-vue/button:  1.0.0 
    @bootstrap-vue/button-group:  1.0.0 
    @bootstrap-vue/button-toolbar:  1.0.0 
    @bootstrap-vue/calendar:  1.0.0 
    @bootstrap-vue/card:  1.0.0 
    @bootstrap-vue/carousel:  1.0.0 
    @bootstrap-vue/collapse:  1.0.0 
    @bootstrap-vue/dropdown:  1.0.0 
    @bootstrap-vue/embed:  1.0.0 
    @bootstrap-vue/form:  1.0.0 
    @bootstrap-vue/form-btn-label-control:  1.0.0 
    @bootstrap-vue/form-checkbox:  1.0.0 
    @bootstrap-vue/form-datepicker:  1.0.0 
    @bootstrap-vue/form-file:  1.0.0 
    @bootstrap-vue/form-group:  1.0.0 
    @bootstrap-vue/form-input:  1.1.0 
    @bootstrap-vue/form-radio:  1.0.0 
    @bootstrap-vue/form-rating:  1.0.0 
    @bootstrap-vue/form-select:  1.0.0 
    @bootstrap-vue/form-spinbutton:  1.0.0 
    @bootstrap-vue/form-tags:  1.0.0 
    @bootstrap-vue/form-textarea:  1.0.0 
    @bootstrap-vue/form-timepicker:  1.0.0 
    @bootstrap-vue/icons:  1.0.0 
    @bootstrap-vue/image:  1.0.0 
    @bootstrap-vue/input-group:  1.0.0 
    @bootstrap-vue/jumbotron:  1.0.0 
    @bootstrap-vue/layout:  1.0.0 
    @bootstrap-vue/link:  1.0.0 
    @bootstrap-vue/list-group:  1.0.0 
    @bootstrap-vue/media:  1.0.0 
    @bootstrap-vue/modal:  1.0.0 
    @bootstrap-vue/nav:  1.0.0 
    @bootstrap-vue/navbar:  1.0.0 
    @bootstrap-vue/overlay:  1.0.0 
    @bootstrap-vue/pagination:  1.0.0 
    @bootstrap-vue/pagination-nav:  1.0.0 
    @bootstrap-vue/popover:  0.0.0 (1.0.0)
    @bootstrap-vue/progress:  1.0.0 
    @bootstrap-vue/scrollspy:  0.0.0 
    @bootstrap-vue/sidebar:  1.0.0 
    @bootstrap-vue/skeleton:  1.0.0 
    @bootstrap-vue/spinner:  1.0.0 
    @bootstrap-vue/table:  1.0.0 
    @bootstrap-vue/tabs:  1.0.0 
    @bootstrap-vue/time:  1.0.0 
    @bootstrap-vue/toast:  1.0.0 
    @bootstrap-vue/tooltip:  0.0.0 (1.0.0)
    @bootstrap-vue/transition:  1.0.0 
    @bootstrap-vue/transporter:  1.0.0 
    @bootstrap-vue/v-b-hover:  1.0.0 
    @bootstrap-vue/v-b-toggle:  1.0.0 
    @bootstrap-vue/v-b-visible:  0.0.0 
    @fortawesome/fontawesome-free: ^6.5.2 => 6.5.2 
    @fortawesome/fontawesome-svg-core: ^6.5.2 => 6.5.2 
    @fortawesome/free-brands-svg-icons: ^6.5.2 => 6.5.2 
    @fortawesome/free-regular-svg-icons: ^6.5.2 => 6.5.2 
    @fortawesome/free-solid-svg-icons: ^6.5.2 => 6.5.2 
    @fortawesome/vue-fontawesome: ^2.0.10 => 2.0.10 
    @vue/cli-plugin-e2e-cypress: ~4.3.0 => 4.3.1 
    @vue/cli-plugin-eslint: ~4.3.0 => 4.3.1 
    @vue/cli-plugin-pwa: ~4.3.0 => 4.3.1 
    @vue/cli-plugin-router: ~4.3.0 => 4.3.1 
    @vue/cli-plugin-unit-mocha: ~4.3.0 => 4.3.1 
    @vue/cli-plugin-vuex: ~4.3.0 => 4.3.1 
    @vue/cli-service: ^3.3.1 => 3.12.1 
    @vue/compiler-sfc:  2.7.14 
    @vue/eslint-config-airbnb: ^5.0.2 => 5.3.0 
    @vue/test-utils: 1.0.0-beta.31 => 1.0.0-beta.31 
    aws-amplify: ^5.3.10 => 5.3.10 
    axios: ^0.21.1 => 0.21.4 (0.26.0)
    bootstrap-vue: ^2.23.1 => 2.23.1 
    chai: ^4.1.2 => 4.3.8 
    eslint: ^6.7.2 => 6.8.0 
    eslint-plugin-import: ^2.20.2 => 2.28.1 
    eslint-plugin-vue: ^6.2.2 => 6.2.2 
    js-md5: ^0.8.3 => 0.8.3 
    moment-timezone: ^0.5.45 => 0.5.45 
    register-service-worker: ^1.7.1 => 1.7.2 
    sass: ^1.56.1 => 1.66.1 
    sass-loader: ^8.0.2 => 8.0.2 
    uiv: ^1.4.2 => 1.4.3 
    uuid: ^9.0.0 => 9.0.0 (3.4.0, 8.3.2)
    v-mask: ^2.2.4 => 2.3.0 
    vue: ^2.6.11 => 2.7.14 
    vue-axios: ^3.2.4 => 3.5.2 
    vue-excel-editor: ^1.3.60 => 1.5.19 
    vue-google-charts: ^0.3.2 => 0.3.3 
    vue-gravatar: ^1.3.1 => 1.4.1 
    vue-moment: ^4.1.0 => 4.1.0 
    vue-number-animation: ^1.0.5 => 1.1.2 
    vue-qr-generator: ^3.0.1 => 3.0.1 
    vue-router: ^3.1.6 => 3.6.5 
    vue-select-image: ^1.9.0 => 1.9.0 
    vue-template-compiler: ^2.6.11 => 2.7.14 
    vue-window-size: ^0.6.2 => 0.6.2 
    vue2-filters: ^0.11.0 => 0.11.1 
    vue2-google-maps: ^0.10.7 => 0.10.7 
    vuex: ^3.1.3 => 3.6.2 
    vuex-persistedstate: ^3.0.1 => 3.2.1 
  npmGlobalPackages:
    @aws-amplify/cli: 11.1.0
    @nestjs/cli: 10.4.2
    @vue/cli-service-global: 4.5.10
    @vue/cli: 5.0.8
    amplify: 0.0.11
    appium-doctor: 1.16.2
    appium: 2.10.3
    aws-amplify: 5.0.4
    chance-cli: 1.0.7
    corepack: 0.25.2
    create-vite: 5.3.0
    cucumber: 7.0.0-rc.0
    json-server: 0.17.0
    knex: 2.0.0
    mocha: 9.1.2
    n: 9.2.1
    nativefier: 50.0.0
    nativescript: 8.1.3
    netlify-cli: 14.4.0
    netlify: 13.1.5
    nodemon: 2.0.19
    npm: 10.7.0
    pm2: 5.2.0
    serve: 14.2.0
    solc: 0.8.13
    swagger: 0.7.5
    yarn: 1.22.19


Describe the bug

Recently I got an issue that told me:

next.js:41 Uncaught (in promise) Error: Invalid predicate. Terminate your predicate with a valid condition (e.g., `p => p.field.eq('value')`) or pass `Predicates.ALL`.
    at internals (next.js:41:1)
    at DataStore.<anonymous> (datastore.js:2178:66)
    at step (tslib.es6.js:100:1)
    at Object.next (tslib.es6.js:81:45)
    at fulfilled (tslib.es6.js:71:42)

The problem is that it's impossible to know where the error is when we have over 1 million lines in an app. The error message is too generic and could relate to any line in a DataStore query. It would be much easier to fix if I could know where or which predicate has the error, rather than just showing me an example of how to write a correct predicate.

I tried looking into tslibs.es6.js and next.js to catch the error, but the changes to the file weren't applied on localhost, so I still have the issue nevertheless it will be great if in the future we could have a better description to find the issue.

Expected behavior

export var internals = function (key) {
    if (!predicateInternalsMap.has(key)) {
        throw new Error(`Invalid predicate: ${currentInvalidPredicate} Terminate your predicate with a valid condition.`);
    }
    return predicateInternalsMap.get(key);
};

Reproduction steps

To reproduce the issue just use an invalid predicate into a query.

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

image
image
image
image
image

@github-actions github-actions bot added pending-triage Issue is pending triage pending-maintainer-response Issue is pending a response from the Amplify team. labels Oct 8, 2024
@ashika112 ashika112 added the DataStore Related to DataStore category label Oct 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DataStore Related to DataStore category pending-maintainer-response Issue is pending a response from the Amplify team. pending-triage Issue is pending triage
Projects
None yet
Development

No branches or pull requests

2 participants