Code Monkey home page Code Monkey logo

Comments (13)

arnaudbesnier avatar arnaudbesnier commented on May 23, 2024 2

Let me reopen this issue, we should definitely support the latest Sequelize versions. It will push us to make it happen ;)

from forest-express-sequelize.

arnaudbesnier avatar arnaudbesnier commented on May 23, 2024 1

Ok, I think you upgraded your Sequelize version, am I wrong?
I think you forbid old Sequelize operators and that make Forest queries to be malformed.
See: http://docs.sequelizejs.com/manual/tutorial/querying.html#operators-aliases

Do you confirm it could be the reason?

from forest-express-sequelize.

danielres avatar danielres commented on May 23, 2024 1

Seems like sequelize dropping the old operators is a security measure.
It's probably a good idea to update forest accordingly.

from forest-express-sequelize.

arnaudbesnier avatar arnaudbesnier commented on May 23, 2024 1

@danielres, you're right, this is something we need to work on.

from forest-express-sequelize.

arnaudbesnier avatar arnaudbesnier commented on May 23, 2024 1

@danielres @TimAstier The fix is now available in the latest liana release 2.2.1

Thanks for the feedback,
🌲🌲🌲

from forest-express-sequelize.

arnaudbesnier avatar arnaudbesnier commented on May 23, 2024

Hey @danielres,

Did you upgrade to a new liana version?
It seems that the error appears in a strange segment or filter that generates this weird condition WHERE "User"."$and" IN (NULL).

Can you share a screenshot of the broken UI?
A screenshot of the request/payload in the Chrome console (Network tab) would be also very helpful.

Thank you for the feedback.

from forest-express-sequelize.

danielres avatar danielres commented on May 23, 2024

I made sure liana ("forest-express-sequelize": "^2.1.1") is at the latest version, didn't fix the issue.

Here are the screenshots, same problem with all the collections (Users, Profiles, Projects, Purchases):

image

image

Thank you for your help.

from forest-express-sequelize.

arnaudbesnier avatar arnaudbesnier commented on May 23, 2024

Can you share the "Headers" tab of the last screenshot, what is interesting to me is the format of the request and especially the payload sent. 🙏

from forest-express-sequelize.

danielres avatar danielres commented on May 23, 2024

sure

image

from forest-express-sequelize.

danielres avatar danielres commented on May 23, 2024

I've been trying to checkout different commits in the project's git history and find at which point the problem ocurs.

The problem seems to appear with a commit that does this:

Changes in our "init" migration (we keep 1 migration while we're in early dev mode, with dropping & migrating the whole db when the migration is changed, and restarting the server).


         CREATE TABLE "User" (
           "id" uuid primary key default uuid_generate_v4(),
+          "authId" varchar NOT NULL UNIQUE,
           "firstName" varchar NOT NULL,
           "lastName" varchar NOT NULL,

server/models/User.js file, used by forest and the rest of the app:

        primaryKey: true,
       },
+      authId: {
+        type: DataTypes.STRING,
+        allowNull: false,
+      },
       firstName: {
         type: DataTypes.STRING,
         allowNull: false,

Before this change, the forest admin works fine.
Still don't undedrstand why this would be triggering the problem. Am I missing something ?

from forest-express-sequelize.

arnaudbesnier avatar arnaudbesnier commented on May 23, 2024

Thanks for sharing, it is really weird.
As the latest error your shared was on the "Projects" collection, can you share the SQL select query error on the "projects" table?

from forest-express-sequelize.

danielres avatar danielres commented on May 23, 2024

sure (I replaced some parts with "..." for confidentiality reasons)

OPTIONS /forest/Project?fields%5BProject%5D=name%2Cstatus%2Cdescription%2CcreatedAt%2CupdatedAt&page%5Bnumber%5D=1&page%5Bsize%5D=10&searchExtended=0&sort=-createdAt&timezone=Europe%2FBerlin 200 0.202 ms - 2
[1] [forest] 🌳🌳🌳  Unexpected error: column Project.$and does not exist
[1] SequelizeDatabaseError: column Project.$and does not exist
[1]     at Query.formatError (.../node_modules/sequelize/lib/dialects/postgres/query.js:356:16)
[1]     at query.catch.err (.../node_modules/sequelize/lib/dialects/postgres/query.js:86:18)
[1]     at tryCatcher (.../node_modules/bluebird/js/release/util.js:16:23)
[1]     at Promise._settlePromiseFromHandler (.../node_modules/bluebird/js/release/promise.js:512:31)
[1]     at Promise._settlePromise (.../node_modules/bluebird/js/release/promise.js:569:18)
[1]     at Promise._settlePromise0 (.../node_modules/bluebird/js/release/promise.js:614:10)
[1]     at Promise._settlePromises (.../node_modules/bluebird/js/release/promise.js:689:18)
[1]     at Async._drainQueue (.../node_modules/bluebird/js/release/async.js:133:16)
[1]     at Async._drainQueues (.../node_modules/bluebird/js/release/async.js:143:10)
[1]     at Immediate.Async.drainQueues [as _onImmediate] (.../node_modules/bluebird/js/release/async.js:17:14)
[1]     at runCallback (timers.js:773:18)
[1]     at tryOnImmediate (timers.js:734:5)
[1]     at processImmediate [as _immediateCallback] (timers.js:711:5)
[2] db_1       | 2018-01-25 14:32:22.872 UTC [81] ERROR:  column Project.$and does not exist at character 84
[2] db_1       | 2018-01-25 14:32:22.872 UTC [81] STATEMENT:  SELECT count("Project"."id") AS "count" FROM "public"."Project" AS "Project" WHERE "Project"."$and" IN (NULL);
[2] db_1       | 2018-01-25 14:32:22.872 UTC [80] ERROR:  column Project.$and does not exist at character 125
[2] db_1       | 2018-01-25 14:32:22.872 UTC [80] STATEMENT:  SELECT "id", "userId", "status", "name", "description", "createdAt", "updatedAt" FROM "public"."Project" AS "Project" WHERE "Project"."$and" IN (NULL) ORDER BY "Project"."createdAt" DESC LIMIT 10 OFFSET 0;
[1] GET /forest/Project?fields%5BProject%5D=name%2Cstatus%2Cdescription%2CcreatedAt%2CupdatedAt&page%5Bnumber%5D=1&page%5Bsize%5D=10&searchExtended=0&sort=-createdAt&timezone=Europe%2FBerlin 500 12.665 ms - 73

from forest-express-sequelize.

danielres avatar danielres commented on May 23, 2024

indeed, locking sequelize to version 4.8.0 solves the problem (instead of ^4.28.6).

Thank you for the great support !

from forest-express-sequelize.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.