Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
  • 10:50
    sailsbot unlabeled #4639
  • 10:50
    himankpathak commented #4639
  • 10:36
    sebastianrcnt starred balderdashy/sails
  • 05:57
    AshutoshSajan starred balderdashy/sails
  • Sep 18 19:20
    udovichenko starred balderdashy/sails
  • Sep 18 14:59
    dubesar starred balderdashy/sails
  • Sep 18 11:08
  • Sep 18 00:02
    crhoover-maxar closed #7087
  • Sep 18 00:02
    crhoover-maxar commented #7087
  • Sep 17 23:33

    eashaw on check-for-invalid-columnName

    Update build-schema.js (compare)

  • Sep 17 23:33

    eashaw on check-for-invalid-columnName


  • Sep 17 23:06
    eashaw commented #1610
  • Sep 17 21:07
    eashaw labeled #7087
  • Sep 17 21:07
    eashaw commented #7087
  • Sep 17 21:07
    mactyr edited #7178
  • Sep 17 21:06
    sailsbot commented #7178
  • Sep 17 21:06
    mactyr opened #7178
  • Sep 17 20:54
    eashaw labeled #7113
  • Sep 17 20:54
    eashaw commented #7113
Eden Corbin
@rachaelshaw wow it does, I/we were overthinking that problem, I see I can link into the function in responses/serverError, and my async errors go there automatically, perfect, thanks.
any suggestion how to test sails with avajs?
I cant get it

i'm getting this

error: Sending 500 ("Server Error") response:
UsageError: Sorry, .exec() doesn't know how to handle {...} callbacks.
Please provide a callback function when calling .exec().
| If you passed in {...} on purpose as a "switchback" (dictionary of callbacks),
| then try calling .switch() intead of .exec().
[?] See https://sailsjs.com/support for more help.

only on my remote server
anyreason why
was using windows previously, trying to deploy onto ubuntu 16.04
Alexander Ostapenko
how can I return Promise from helper?
Sachin Pachari

Hi Guys, I am trying to connect to mongo using sails adapter, and i am using trying to set auth-source as "etc/*.pem" file. but not sure how to set this up using the config/connections.js file.

Thanks in advance.

I am getting an error in v1. User.findOne( {id: user.id } ) throws an error: Cannot findOne() without specifying a more specific where clause. I thought specifying the exact ID should be specific enough, right? Anyone seen this before?
Venkat Sai Gajendrula
I am facing issue while installing sails globally

coffee-script@1.12.8 postinstall C:\Users\vesai\AppData\Roaming\npm\node_modules\sails\node_modules\csextends\node_modules\coffee-script
node --eval 'if (require("./package.json").name === "coffee-script") { var red, yellow, cyan, reset; red = yellow = cyan = reset = ""; if (!process.env.NODE_DISABLE_COLORS) { red = "\x1b[31m"; yellow = "\x1b[33m"; cyan = "\x1b[36m"; reset = "\x1b[0m"; } console.warn(red + "CoffeeScript has moved!" + reset + " Please update references to " + yellow + "\"coffee-script\"" + reset + " to use " + yellow + "\"coffeescript\"" + reset + " (no hyphen) instead."); console.warn("Also, a new major version has been released under the " + yellow + "coffeescript" + reset + " name on NPM. This new release targets modern JavaScript, with minimal breaking changes. Learn more at " + cyan + "http://coffeescript.org" + reset + "."); console.warn(""); }'


SyntaxError: Invalid or unexpected token
at createScript (vm.js:80:10)
at Object.runInThisContext (vm.js:139:10)
at Object.<anonymous> (eval-wrapper:6:22)
at Module._compile (module.js:635:30)
at evalScript (bootstrap_node.js:462:27)
at startup (bootstrap_node.js:163:9)
at bootstrap_node.js:608:3

Anyone faced with the same problem ?
Alexandre Madurell
@ChrisWorks Have you checked the records of the User model/table? If you had duplicate records on that index, or the id attribute isn't defined as unique, it would throw that error. It doesn't make sense, I know, but... just to be sure that's not the case
praveen kumar
Hi All,
I got an error in sails inversible model for sql TypeError: Cannot read property 'toLowerCase' of undefined
at Object.exports.toSailsAttribute
anyone help me?
Alexandre Madurell
@praveen4554 sounds like the instance of that model is empty. Can you copy/paste the line of your code where you have the .toLowerCase? (plus... shouldn't it be .toLowerCase()?)
praveen kumar

@amadurell my code var sim = require('sails-inverse-model');

var config = {
host: "localhost",
database: "don",
user: "root",
password: "root",
port: 3306
var folder_controllers = "";
var folder_models = "./api/models";
var folder_views = "";

sim.generatemy(config, folder_models, folder_controllers, folder_views);

@amadurell error home/infinate/raju-ui/ddnrp/swagger/ddn/node_modules/mysql/lib/protocol/Parser.js:80
throw err; // Rethrow non-MySQL errors

TypeError: Cannot read property 'toLowerCase' of undefined
at Object.exports.toSailsAttribute (/home/infinate/raju-ui/ddnrp/swagger/ddn/node_modules/sails-inverse-model/generator/mysql/compiler_mysql.js:108:14)
at transpile (/home/infinate/raju-ui/ddnrp/swagger/ddn/node_modules/sails-inverse-model/generator/mysql/compiler_mysql.js:94:18)
at /home/infinate/raju-ui/ddnrp/swagger/ddn/node_modules/sails-inverse-model/generator/mysql/compiler_mysql.js:47:28
at Query._callback (/home/infinate/raju-ui/ddnrp/swagger/ddn/node_modules/mysqldesc/lib/describing/mysql_describer.js:137:13)
at Query.Sequence.end (/home/infinate/raju-ui/ddnrp/swagger/ddn/node_modules/mysql/lib/protocol/sequences/Sequence.js:88:24)
at Query._handleFinalResultPacket (/home/infinate/raju-ui/ddnrp/swagger/ddn/node_modules/mysql/lib/protocol/sequences/Query.js:139:8)
at Query.EofPacket (/home/infinate/raju-ui/ddnrp/swagger/ddn/node_modules/mysql/lib/protocol/sequences/Query.js:123:8)
at Protocol._parsePacket (/home/infinate/raju-ui/ddnrp/swagger/ddn/node_modules/mysql/lib/protocol/Protocol.js:279:23)
at Parser.write (/home/infinate/raju-ui/ddnrp/swagger/ddn/node_modules/mysql/lib/protocol/Parser.js:76:12)
at Protocol.write (/home/infinate/raju-ui/ddnrp/swagger/ddn/node_modules/mysql/lib/protocol/Protocol.js:39:16)
at Socket.<anonymous> (/home/infinate/raju-ui/ddnrp/swagger/ddn/node_modules/mysql/lib/Connection.js:103:28)
at emitOne (events.js:96:13)
at Socket.emit (events.js:191:7)
at readableAddChunk (_stream_readable.js:178:18)
at Socket.Readable.push (_stream_readable.js:136:10)
at TCP.onread (net.js:561:20)

Alexandre Madurell
@praveen4554 Let me try it here...
praveen kumar
@amadurell sails 0.12.14 and sails-inverse-model 2.0.5
Alexandre Madurell
@praveen4554 yup... looks like it has a bug... I'm out to lunch now, but I'll take another look later. Interesting tool (if it only worked!)
Alexander Ostapenko
@ChrisWorks just use User.findOne(user.id) or User.findOne({ where: { id: user.id } })
praveen kumar
@amadurell Thank you I am looking for your solution
@amadurell Yes it seems that there is indeed multiple records in the localDiskDb/user.db, which should not happen of course. I may have issues defining my "id" attribute. I have this in my config\model.js
id: { type: 'number', columnName: '_id', autoIncrement: true}
I find this tricky to figure out - as this will differ from when I starting using a database. How do I handle the "id" definition when switching back and forth between localDiskDb and e.g. Mongo?
Alexandre Madurell
Add unique: true
@ChrisWorks So it becomes: id: { type: 'number', columnName: '_id', autoIncrement: true, unique: true}
@amadurell That did not actually work. The user is actually still created twice the user.db. (I delete the db and relift sails) My user.db looks like this:
@amadurell You can see the createdAt is the same weird, but updatedAt are different .. and _id is the same, how is that possible?
Alexandre Madurell
@ChrisWorks Did you lift sails --drop? (if not, before you do, back up your data). Regarding localDiskDb and Mongo, not sure how you want to handle that, but I guess once you transfer the data from one to the other, you will want to remove the reference to the former in the datastores? Or is that intended to synchronize one with the other when offline/online?
@ChrisWorks I guess you'll have to delete the duplicate entries manually in the user.db file, since they were allowed before adding the unique attribute... If you lift sails --drop everything should be erased, and the data structure recreated... otherwise, I think lift sails --alter will throw an error since those previous records are incompatible with the new data structure definition
@amadurell I delete the full localDiskDb folder, so the user.db is created from scratch when I lift sails and is therefore completely empty. Then a hook is creating the admin user, and the User.afterCreate is called once, but 2 entries are displayed in the user.db. .... how is that possible?
Alexandre Madurell
@ChrisWorks Are you connected to both localDiskDB and Mongo? Did you try lifting sails with the --drop option?
@amadurell With the --drop my user.db looks like this:
@amadurell There are only 2 entries in user.db but they still get the same _id (2)
@amadurell I use localDiskDb only (no mongo yet)
How can sails allow 2 entries to have the same "_id" when the id is defined like this: id: { type: 'number', columnName: '_id', autoIncrement: true, unique: true}
Alexandre Madurell
@ChrisWorks The only difference I see is in the owner value... but still, it shouldn't let you repeat a record with a repeated unique attribute... weird... I'm not too familiar with afterCreate unfortunately :(
I dont where the bug is, but it could be either in my code, which uses the module sails-auth-new (for v1), which again calls passport.register :( This all worked fine on 0.12.14
@amadurell Thanks for the help anyways. :)
Alexandre Madurell
@ChrisWorks Just my daily quota of rubber-ducking ;) https://en.wikipedia.org/wiki/Rubber_duck_debugging
@amadurell ha ha :smile:
praveen kumar
@amadurell do you have chance for sails inverse model
hi guys... is there a possibility to search by collection attribute inside model?
for example... I have model Books with attribute category which is collection of model Category
can I query like this: Books.find({category: [ID OF CATEGORIES TO FIND BOOKS FOR]})
i get this warning: Could not use the provided where clause. Could not filter by category: Cannot filter by category because it is a plural association (which wouldn't make sense).
i dont think this is true... for me this have sense :) correct me if im wrong... but is this possible to do without using native query??