Open HarrisAutomed opened 5 years ago
@HarrisAutomed Thanks for posting! We'll take a look as soon as possible.
In the mean time, there are a few ways you can help speed things along:
Please remember: never post in a public forum if you believe you've found a genuine security vulnerability. Instead, disclose it responsibly.
For help with questions about Sails, click here.
@HarrisAutomed - I wasn't able to reproduce this error in a new Sails app with all the same versions, adapter, and configuration you provided.
Can you try this out in a new Sails v1.1.0 app and configure your MySQL datastore in there to see if it still throws this error?
@johnabrams7 I just created a new Sails 1.0 project.
I having no problem running with the same configuration, until I tried adding the dependencies 1 by 1.
I managed to replicate the error by the npm install as below:
sails-sql lodash async moment randomstring q ------------------------> (this installation causes the same error after I did a npm install, I think it belongs to this: https://www.npmjs.com/package/q)
Let me know if you manage to replicate the same thing.
@johnabrams7 I have managed to resolve the problem. So the real issue is not because of the packages, it is about setting "autoIncrement: true" in the database model.
My id for the tables are using UUID, so I thought setting autoIncrement: true is not necessary. However, I tested my model in a newly created project, and discovered that setting autoincrement to false, or not putting it causes the orm to fail.
I managed to get my project runs again by setting autoIncrement: true to all my id, even though they are using UUID. Do feel free to let me know if this setting might cause any issues.
@HarrisAutomed - Glad that worked out and thanks for providing the workaround! autoIncrement: true should be safe with UUID as far as I've seen - it basically increments the most recent record's value by one if nothing else is providing this value. MySQL only allows one auto-incrementing column per table.
On another note, we're currently developing a more powerful sails-sql adapter which also supports MySQL and adds more functionality and support beyond sails-mysql. Feel free to give it a try - hope this helps and thanks again!
I faced the same issue with MySQL adapter and datastore config. It got fixed when I used a plain alphanumeric mysql password without special characters. FYI my earlier password was "K!a(HK$%{K". Thanks for https://github.com/balderdashy/sails/issues/4069#issuecomment-495046633 for the tip!
I faced the same issue with MySQL adapter and datastore config. It got fixed when I used a plain alphanumeric mysql password without special characters. FYI my earlier password was "K!a(HK$%{K". Thanks for #4069 (comment) for the tip!
This worked for me as well.
To anyone that may stumble upon this (as of Sails v1.2.4), when using UUID's for your primary key, you DO NOT need to set autoIncrement
, you just need to set required: true
. @HarrisAutomed and @johnabrams7 thought you would like to know, so you could update your models to look & feel a bit nicer / a bit more proper.
To anyone that may stumble upon this (as of Sails v1.2.4), when using UUID's for your primary key, you DO NOT need to set
autoIncrement
, you just need to setrequired: true
. @HarrisAutomed and @johnabrams7 thought you would like to know, so you could update your models to look & feel a bit nicer / a bit more proper.
Doing so requires me to manually set the id each time I want to insert data in the db, instead of it being generated for me.
The workaround that works for me is doing this:
"primaryKey": "id",
"dontUseObjectIds": true,
"attributes": {
"createdAt": { "type": "number", "autoCreatedAt": true },
"updatedAt": { "type": "number", "autoUpdatedAt": true },
"id": { "type": "number", "columnName": "_id", "autoIncrement": true, "unique": true },
Node version: 10.15.3 Sails version (sails): 1.1.0 ORM hook version (sails-hook-orm): ^2.1.1 Grunt hook version (sails-hook-grunt): ^3.1.0 DB adapter & version (e.g. sails-mysql@5.55.5): sails-mysql@latest
I just updated my sails 0.xxx to sails 1.1.0, I have made changes to the models, clearing up warnings and tried to setup the configuration.
However, I keep getting this error when I try to run it:
This is my config.models:
This is my config.globals:
This is my config.datastores (without revealing sensitive database info):
I also have a production.js for production environment, development.js for development environment:
I have also done a npm install of sails-hook-orm, sails-hook-sockets, sails-hook-grunt, and sails-mysql