Tuesday, 14 March 2017

Seneca and Async Await in Node 7.7.x

We've been using Seneca in our Sails.js project for a while and it's been working fine. We wrapped it in a service, which we've called MessageBus. We basically wrapped it in a promise like this suggests (Look for the Promise.promisify part). It's been great, but we would now like to use async/await instead of chaining .then() together. With some of our calls, we end up having to chain a whole bunch of calls together.

To move along this route, we installed seneca-await and promisified that as well. We marked functions as async, called await when necessary, and still got the following error:

Seneca Fatal Error
==================

Message: seneca: use-plugin: No name property found for plugin defined by Object {}.

Code: plugin_no_name

Before trying seneca-await we just tried async/await on our seneca calls and got the same error as above.

Has anyone successfully implemented async/await in a Sails.js project, and/or with Seneca?



via pjlamb12

No comments:

Post a Comment