nxus / users

User management module for Nxus apps.
MIT License
0 stars 0 forks source link

Error with roles in production #26

Closed mjreich closed 7 years ago

mjreich commented 7 years ago

I get the following error on a production environment on nxus startup:

Unhandled rejection Error (E_UNKNOWN) :: Encountered an unexpected error
SELECT "users-role"."role", "users-role"."systemDefined", "users-role"."permissions", "users-role"."id", "users-role"."createdAt", "users-role"."updatedAt" FROM "users-role" AS "users-role"  WHERE "users-role"."role" = 'Admin'  LIMIT 1 - SQLITE_ERROR: no such table: users-role
mjreich commented 7 years ago

The issue here is that my waterline defaults.migrate option was set to safe. This means the table was never created.

Solution: change the environment variable (or .nxusrc config option) nxus_storage__defaults__migrate to create instead of safe

mjreich commented 7 years ago

@ScottMaxson specific reason for reopening?

ScottMaxson commented 7 years ago

Not working for my build. I'm getting exact same error; setting nxus_storagedefaultsmigrate to "create" (or "alter") isn't helping. Tried this setting in the .nxusrc too: "storage": { "adapters": { "default": "waterline-sqlite3" }, "connections": { "default": { "adapter": "default" } }, "defaults": { "migrate": "create" } },

mjreich commented 7 years ago

@ScottMaxson are you getting the exact same error or a slightly different one? Note, this error (and fix) will only apply where NODE_ENV is set to production.

ScottMaxson commented 7 years ago

OK it's actually a bit different but seems like it's a need to refresh or build the schema:

Unhandled rejection Error (E_UNKNOWN) :: Encountered an unexpected error : SELECT "users-role"."role", "users-role"."systemDefined", "users-role"."permissions", "users-role"."id", "users-role"."createdAt", "users-role"."updatedAt" FROM "users-role" AS "users-role" WHERE "users-role"."id" IN ) - SQLITE_ERROR: near ")": syntax error at Error (native)

ScottMaxson commented 7 years ago

NVM should be a new issue. Sorry for the confusion.

mjreich commented 7 years ago

@ScottMaxson this is already capture in #25 I believe