Skip to content

[FIX] Introduce AppLivechatBridge.isOnlineAsync method#16467

Merged
d-gubert merged 4 commits intodevelopfrom
omnichannel/make-isonline-bridge-method-async
Feb 10, 2020
Merged

[FIX] Introduce AppLivechatBridge.isOnlineAsync method#16467
d-gubert merged 4 commits intodevelopfrom
omnichannel/make-isonline-bridge-method-async

Conversation

@renatobecker
Copy link
Contributor

To properly run the AppLivechatBridge.isOnline method, it needs to become an asynchronous method.
Otherwise, we will get an error as shown below when executing it through the Apps-Engine:

W20200204-17:15:09.944(-3)? (STDERR) Exception on find Error: Meteor code must always run within a Fiber. Try wrapping callbacks that you pass to non-Meteor libraries with Meteor.bindEnvironment.
W20200204-17:15:09.945(-3)? (STDERR)     at Object.Meteor._nodeCodeMustBeInFiber (packages/meteor.js:1186:11)
W20200204-17:15:09.945(-3)? (STDERR)     at Meteor.EnvironmentVariable.EVp.get (packages/meteor.js:1199:10)
W20200204-17:15:09.946(-3)? (STDERR)     at Object.collection.<computed> [as find] (packages/matb33_collection-hooks.js:136:37)
W20200204-17:15:09.946(-3)? (STDERR)     at Collection.find (packages/mongo/collection.js:334:29)
W20200204-17:15:09.946(-3)? (STDERR)     at BaseDb.find (app/models/server/models/_BaseDb.js:130:21)
W20200204-17:15:09.946(-3)? (STDERR)     at Users.find (app/models/server/models/_Base.js:116:29)
W20200204-17:15:09.946(-3)? (STDERR)     at Users.findBotAgents (app/models/server/models/Users.js:112:15)
W20200204-17:15:09.946(-3)? (STDERR)     at Object.getBotAgents (app/livechat/server/lib/Livechat.js:96:16)
W20200204-17:15:09.946(-3)? (STDERR)     at Object.online (app/livechat/server/lib/Livechat.js:60:31)
W20200204-17:15:09.947(-3)? (STDERR)     at AppLivechatBridge.isOnline (app/apps/server/bridges/livechat.js:16:19)
W20200204-17:15:09.947(-3)? (STDERR)     at LivechatRead.isOnline (/Volumes/Workspace/Rocket.Chat/node_modules/@rocket.chat/apps-engine/server/accessors/LivechatRead.js:9:36)
W20200204-17:15:09.947(-3)? (STDERR)     at WhatsAppMessageEndpoint.post (evalmachine.<anonymous>:31:56)
W20200204-17:15:09.947(-3)? (STDERR)     at processTicksAndRejections (internal/process/task_queues.js:93:5) { roles: { '$all': [ 'bot', 'livechat-agent' ] } }
``

@renatobecker renatobecker requested review from rodrigok and removed request for rodrigok February 5, 2020 03:05
@d-gubert
Copy link
Member

d-gubert commented Feb 5, 2020

this is a breaking change to the Apps-Engine definition, which blocks us from changing it until the next major version.

@lolimay this is the same problem we've discussed here, can you work with @renatobecker to introduce a new method and deprecate this one?

@rodrigok do you think there is a better way to handle this situation?

@renatobecker
Copy link
Contributor Author

renatobecker commented Feb 5, 2020

this is a breaking change to the Apps-Engine definition, which blocks us from changing it until the next major version.

@lolimay this is the same problem we've discussed here, can you work with @renatobecker to introduce a new method and deprecate this one?

@rodrigok do you think there is a better way to handle this situation?

Thanks @d-gubert for your comment, we just need to have a quick definition of this matter because Caixa is waiting for this implementation to be able to use properly their App.
They are complaining about the current behavior on their App because of the current implementation is causing a very bad user experience.

@RocketChat RocketChat deleted a comment from claassistantio Feb 5, 2020
@claassistantio
Copy link

claassistantio commented Feb 5, 2020

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ renatobecker
❌ d-gubert
You have signed the CLA already but the status is still pending? Let us recheck it.

@rodrigok
Copy link
Member

rodrigok commented Feb 5, 2020

@d-gubert since it was introduced 2 days ago and the release is under release candidate still I don't see any problems incorporating this beaking change.

@rodrigok
Copy link
Member

rodrigok commented Feb 5, 2020

We can release a new version and deprecate the old one where the feature was introduced

@d-gubert
Copy link
Member

d-gubert commented Feb 5, 2020

@rodrigok this functionality has actually been introduced 2 months ago by this PR and has been part of the API since then

@rodrigok
Copy link
Member

rodrigok commented Feb 5, 2020

@d-gubert I see, so, yes, need to create a new method

@d-gubert d-gubert changed the title [FIX] Make the AppLivechatBridge.isOnline method asynchronous [FIX] Introduce AppLivechatBridge.isOnlineAsync method Feb 10, 2020
@d-gubert d-gubert merged commit 5b840d1 into develop Feb 10, 2020
@d-gubert d-gubert deleted the omnichannel/make-isonline-bridge-method-async branch February 10, 2020 22:26
gabriellsh added a commit that referenced this pull request Feb 11, 2020
* 'develop' of github.com:RocketChat/Rocket.Chat:
  Regression: UIkit input states (#16552)
  [FIX] Do not stop on DM imports if one of users was not found (#16547)
  [FIX] Introduce AppLivechatBridge.isOnlineAsync method (#16467)
gabriellsh added a commit to ritwizsinha/Rocket.Chat that referenced this pull request Feb 13, 2020
…5997-ritwizsinha-15996

* 'develop' of github.com:RocketChat/Rocket.Chat: (181 commits)
  Update Livechat widget dependency version to 1.3.1. (RocketChat#16580)
  Update Apps-Engine version (RocketChat#16584)
  [FIX] Error when successfully joining room by invite link (RocketChat#16571)
  Add breaking notice regarding TLS (RocketChat#16575)
  [FIX] Invite links proxy URLs not working when using CDN (RocketChat#16581)
  Regression: Modal onSubmit (RocketChat#16556)
  Regression: UIkit input states (RocketChat#16552)
  [FIX] Do not stop on DM imports if one of users was not found (RocketChat#16547)
  [FIX] Introduce AppLivechatBridge.isOnlineAsync method (RocketChat#16467)
  Regression: UIKit missing select states: error/disabled (RocketChat#16540)
  [BREAK] Change apps/icon endpoint to return app's icon and use it to show on Ui Kit modal (RocketChat#16522)
  Regression: update package-lock (RocketChat#16528)
  Regression: Update Uikit (RocketChat#16515)
  Regression: UIKit - Send container info on block actions triggered on a message (RocketChat#16514)
  Use base64 for import files upload to prevent file corruption (RocketChat#16516)
  Regression: Ui Kit messaging issues RocketChat#16513
  Regression: Send app info along with interaction payload to the UI (RocketChat#16511)
  Fix: License missing from manual register handler (RocketChat#16505)
  Exclude federated and app users from active user count (RocketChat#16489)
  Remove users.info being called without need (RocketChat#16504)
  ...
@sampaiodiego sampaiodiego mentioned this pull request Feb 15, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants