Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
Eric Y
@enuggetry
2 replies
Parth Trivedi
@parth5049
@abrantes01 are you still facing the connection pool issue? I have started facing the same in productive environment and this happens only sometimes like once in 10 days. When I check the connections in RDS Postgres, it remains below 10 so I am wondering if you managed to fix that. I am using RDS Aurora Postgres.
vandana109
@vandana109
image.png
Can someone help me in resolving this issue
I have disabled all in globals object
Vladimir Núñez
@black3xp
Hi, i need help with socket Sails
Captura realizada el 2021-09-07 14.40.21.png
Clemens Rau
@ClemensRau1337
Hey :) did some one allready See
the error in frontend: CloudError: („observemysession“) responded With an error
bleikg9
@bleikg9
@black3xp I had a problem with sockets my self, turned out the socket versions I was using between client and server where mix matched and sockets are picky to which version they connect to.
I have a Time-Zone problem -> I'm storing my dates in UTC-5 format using Moment to set the timezone. In my DB it displays the correct timestamp and date i sent to the table. but when im reading of the table it beings back the UTC timestamp is there anyway to correct this, I dont want to iterate through all my results everytime. I've tried setting the process.env.TZ but still no luck. Open to suggestions
bleikg9
@bleikg9
NVM Solved with the suggestion from @_mikeusa_twitter setting the datastore's timezone to UTC did the trick
Noitidart
@Noitidart
has anyone sent an inline image in mailgun with sails mailgun api?
Paulo Brás
@PABCon
Hello All, I'm having issues with uploading a file with Vue JS and Sails JS.
My Front-end shows that the request has been sent with FormData : Binary and the server side seems to be fine, but when I make a UploadFile.length it comes = 0
Server-side
 req.file('avatar').upload({

          dirname: require('path').resolve(sails.config.appPath, 'assets/uploads')


      }, function whenDone(err, uploadedFile) { 
          console.log(uploadedFile.length)

            return res.ok()

      });
    }
I don't see the files getting save. Any idea from anyone?
POST /sendFile HTTP/1.1
Host: localhost:1337
Connection: keep-alive
Content-Length: 595119
sec-ch-ua: "Google Chrome";v="93", " Not;A Brand";v="99", "Chromium";v="93"
Accept: application/json, text/plain, */*
Content-Type: multipart/form-data; 
sec-ch-ua-mobile: ?0
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.63 Safari/537.36
sec-ch-ua-platform: "Windows"
Origin: http://localhost:1337
Sec-Fetch-Site: same-origin
Sec-Fetch-Mode: cors
Sec-Fetch-Dest: empty
Referer: http://localhost:1337/job
Accept-Encoding: gzip, deflate, br
Accept-Language: en,pl-PL;q=0.9,pl;q=0.8,en-US;q=0.7,pt;q=0.6,fr;q=0.5,es;q=0.4
FormData content
------WebKitFormBoundaryB5mB9neeX4AxoFYB
Content-Disposition: form-data; name="file"; filename="Fake CV.pdf"
Content-Type: application/pdf


--------
arcticmicho
@arcticmicho

Hello All! I'm having an issue with MongoDB and GridFS. I have an action who upload a photo and then create a new entry using the fd id of the previous file uploaded (I'm using the Ration project as example). But mongo is throwing an error:

verbo: MongoError: pool is draining, new operations prohibited
Upstream (file upload: photo) emitted an error: MongoError: pool is draining, new operations prohibited

I'm using the sails-hook-upload package to do upload operations.

arcticmicho
@arcticmicho
It seems that one solution would be to pass the poolSize parameter to the mongoDb client but I don't know where to put this parameter since the url configurations and adapter of mongo are given by the upload and datastore configurations of sails.
arcticmicho
@arcticmicho
At the end I was not able to make it work... it seems that the issue is related to using MongoDB for the Datastores and for the uploads at the same time. I have changed the Upload adapter to S3 and it's working like charm.
Greg-J
@Greg-J
I have a section of a project that displays a number of metrics. These metrics are provided by an external API and then some logic is performed on that data before being passed to the presentation layer. I use partials for partial presentation layer stuff, but what would be 'the sails way' of handling the logic for that partial?
Greg-J
@Greg-J
crickets
Probably an inappropriate place to ask this, but anyone know of a Sails-like Sails alternative with a reasonably active community?
Mike
@_mikeusa_twitter
There’s plenty of Node frameworks. Probably easier to Google. I’m barely in Gitter anymore because their iOS app is horrendous.
1 reply
And to answer your question it all depends on what you’re doing. Business logic tends to be in Models, so you should have a model connected to that API. For presentation, you’d want to either have different views, controlled by the Controller, or embed it in the View if that’s how you have it wired up.
You may benefit from using Parasails depending on your front-end framework
Mike
@_mikeusa_twitter
@Greg-J per Sailsdocs, policies mentions to use actions for role-based permissions (https://sailsjs.com/documentation/concepts/policies)
Mike
@_mikeusa_twitter
For example, if you need to implement user-level or role-based permissions in your application, the most straightforward solution is to take care of the relevant checks at the top of your controller action—either inline or by calling out to a helper. Following this best practice will significantly improve the maintainability of your code.
Paulo Brás
@PABCon
Could anyone advise on the issue I raised with the file upload?
13 replies
Greg-J
@Greg-J
Has anyone had this error trying to lift sails in production:
error: A hook (policies) failed to load!
Warning: connect.session() MemoryStore is not
designed for a production environment, as it will leak
memory, and will not scale past a single process.
I'm also getting an error of: error: Failed to lift app: Error: Attempted to require('/home/neonpixe/node/dashboard/api/policies/isLoggedIn.js'), but an error occurred:
Then it goes onto cannot find module etc.
Greg-J
@Greg-J
This application lifts fine locally without the production environment var being set. It also works fine with the production adapter and url
I'm trying to lift this with A2 Hosting, if anyone has any experience with them...
This is driving me bonkers
Mike
@_mikeusa_twitter
A2 is good, are you SSH’d in? What’s in your package.json? Have all packages been installed? Are you trying to rely on global packages?
1 reply
siameseSerpent
@siameseSerpent

I am in the process of updating an existing Sails 0.12.x application to a sails 1.x application. In some of my views, I access req.options.controller to set the id of a div. Then, when loading a page, I check in the associated loaded javascript files using jquery if such a div exists in order to determine whether or not to run certain logic on that page.
For example, say have the following route in routes.js:
GET /foo/bar { controller: FooBarController, action: index }

I then have in a view something like <div id='<% req.options.controller %>'></div> using EJS
Then, in the javascript that gets loaded on that page, I have something like
if($('#foo/bar').length > 0){ // id detected on page, run this javascript block }

However, it seems that the behavior of req.options.controller has changed between 0.12 and 0.1.x. It looks like it used to return foo/bar, but it now returns FooBarController as it should. Is there a way to replicate the previous behavior or a different property that will work similar to how req.options.controller used to work?

Greg-J
@Greg-J
My package.json looks like so: https://pastebin.com/a3drq85n
To be candid, I'm not sure if I'm trying to rely on global packages. I've SSH'd in, but there is no npm command available. I tried lifting the app through their cPanel>node interface and so far nothing is working.
Revadike
@revadike:matrix.org
[m]
Hey y'all
So here is an interesting problem
I want to load sails configuration from the ORM datastore
The workaround I am currently using, is starting sails twice
First to get the saved config from the datastore, then use that data to start sails again
Any ideas how to do it in a proper manner?
I was thinking of perhaps using the hook configure method, but then we also still don't have access to the ORM
Revadike
@revadike:matrix.org
[m]
welp this seems ded
Mike
@_mikeusa_twitter
There is nothing proper about what you asked.
What are you trying to do? Set up a replication?
Revadike
@revadike:matrix.org
[m]
goal was stated as: I want to load sails configuration from the ORM datastore
for example, let the user set the server port via the sails website portal itself
i assume you cannot reassign sails config after it has loaded already
NeoNexus DeMortis
@neonexus

I would recommend having an endpoint that reads the configuration from the datastore, then spawns a detached child process running the new sails instance, and kills the parent. You can use environment variables in your env/config files, like I did here, and spawn / kill like this:

const { spawn } = require('child_process');

environmentVariables = _.merge({}, process.env, {
     BASE_URL: 'insert new custom value here',
     PORT: newPortVariable
});

const child = spawn('sails', ['lift'], {
     detached: true,
     stdio: 'ignore',
     env: environmentVariables
});

child.unref(); // allow the parent to die, and the child will live on

process.exit(0);

Since sails does take a minute to load, this should work, even if the port doesn't change.

Revadike
@revadike:matrix.org
[m]
well this is basically what i'm doing now, just in a less convoluted way
NeoNexus DeMortis
@neonexus
Then your only other option would be to have the script do the same thing, but write the changes to the config files.