Using DynamoDB / datastore.js without Hyperweb


#1

I’d like to use DynamoDB and the datastore.js library that is in all of the tutorials / documentation, but I haven’t been using Hyperweb and would prefer not to switch to it.

When I call datastore.set(…), I’m getting the error “Error: no current Fiber, defer can’t be used without Fiber!”

I assume it’s because I’m not using Hyperweb, although I’m not 100% sure.

Can you confirm if that’s the issue, and if it is, consider documentation for people who don’t want to use Hyperweb?


#2

The DynamoDB is offered to support use of HyperDev, rather than as a standalone service in its own right. So I understand, what do you see as the advantage of using DynamoDB/datastore by itself?


#3

I think you’re confusing Hyperweb and HyperDev. I am using HyperDev, and have built my project based on the initial Express server that it had by default. Hyperweb is a framework of some sort that appears to have been introduced later.

My intention is to use datastore / DynamoDB with HyperDev - I just want to see if it’s possible to not use the Hyperweb library.


#4

What is the problem with HyperWeb?

From what I’ve seen - maybe I’m wrong - but it just adds onto express. Your app should work the same, just with extra helper methods.

Otherwise, this should help you

hyperweb is a library we created that wraps all those fiddly little services that you need to create a full app. Relevant to this app, it pulls in Express and the AWS SDK (amongst other things) that we need to create routes in our application and interact with the DynamoDB.


#5

I’m not a fan of having my code be tied to the infrastructure it’s running on. Before HyperWeb, HyperDev was awesome because it was a stock Express app that I could take and run anywhere. Once you need the HyperWeb library, it feels like my code is no longer portable, and I might as well be coding for some other proprietary framework.

The documentation you linked doesn’t help (I’m already aware of it), because it demonstrates using DynamoDB with HyperWeb. I’m trying to use DynamoDB without HyperWeb.


#6

HyperDev, the product, also used to be known as HyperWeb, so yeah it gets confusing.

You can use datastore without the Hyperweb framework. Here’s an example project that uses datastore without Hyperweb - just Express with Nunjucks. If you’re still seeing that error, then make sure you’re initializing the datastore (and do so after the code to set up the http server).

If your project doesn’t use Express at all, then you can just use var sync = require("synchronize"); and then you always have to wrap the function that uses the (sync) datastore this way: sync.fiber(function () { /* function body */ }). The async datastore can always be used without that, but it uses Promises so it’s a bit more complex to use. For reference, here’s an example without Hyperweb, using async.

Incidentally, the Hyperweb framework is what the welcome project initially used, but we moved away from it for the portability reasons you state. So that isn’t a change to try to lock folks in, quite the opposite - we want to keep HyperDev as open as possible and keep code portable and that’s the direction we’re committed to.


#7

Hey all,

Just updating this thread with a note that DynamoDB support is being deprecated with an upcoming infrastructure update. The short reason why is that we don’t feel like it’s a user-friendly or maintainable solution going forward.

here’s a longer explanation

We recommend that you use a third party db as a service like mlab, heroku postgres, or redis-cloud instead.

thx!