balderdashy / sails

Realtime MVC Framework for Node.js
https://sailsjs.com
MIT License
22.84k stars 1.95k forks source link

CloudError: Endpoint (`observeMySession`) #7292

Closed tlgtrn closed 1 year ago

tlgtrn commented 1 year ago

Node version: 20.5.0 Sails version (sails): 1.5.7 ORM hook version (sails-hook-orm): 4.0.0 Sockets hook version (sails-hook-sockets): 2.0.0 Organics hook version (sails-hook-organics): 2.0.0 Grunt hook version (sails-hook-grunt): 5.0


First install according to "get-started" and created "Web App"

Signed up with email address and when I try login I am facing this error.

"CloudError: Endpoint (observeMySession) responded with an error (or the request failed)."

Uncaught (in promise) CloudError: Endpoint (observeMySession) responded with an error (or the request failed). exec http://localhost:1337/dependencies/cloud.js:649 _promise http://localhost:1337/dependencies/cloud.js:612 toPromise http://localhost:1337/dependencies/cloud.js:610 then http://localhost:1337/dependencies/cloud.js:592

cloud.js:649:33

sailsbot commented 1 year ago

@tlgtrn 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.

usmanghani599 commented 1 year ago

I am also facing same issue. Any solution please?

sreehari-nallapaneni commented 1 year ago

Hi, As a temporary fix you can try the following.

step 1: Open your-project\assets\js\components\account-notification-banner.component.js step 2: Replace mounted method with following

mounted: async function() {
    try{
      await Cloud.observeMySession();
      // Listen for updates to the user's session
      Cloud.on('session', (msg)=>{
        if(msg.notificationText) {
          this.notificationText = msg.notificationText;
        } else {
          this.notificationText = '';
        }
      });//œ
    }
    catch(e){
      console.log(`some error : `, e);
    }
  }

Reason replacing mounted method is, in the mounted method await Cloud.observeMySession(); throws an error that is not handled, So we are handling that error with try/catch.

rizikoblogger commented 1 year ago

I am facing the same.

The temporary solution above works, but we keep without WebSocket capability because 'sails.sockets' is working nomore.

It looks like _csrf is not being sent into window.SAILS_LOCALS, so

I recommend you set false csrf attribute into config/security.js file - for a while.

I mean - FOR A WHILE - due to security issues around lack of CSRF control.

mikermcneil commented 1 year ago

@rizikoblogger @sreehari-nallapaneni @usmanghani599 @tlgtrn Patch otw (see also #7297)

mikermcneil commented 1 year ago

Published as v1.5.8