Using GetStream.io in Elixir Phoenix Project

Does anybody here have experience using http://getstream.io within your Phoenix project? It comes with a node module which I have added to my dependencies and installed.

When using the code from the getting started tutorial in my app.js file I get the error app.js:61 Uncaught Error: Cannot find module 'getstream/src/lib/batch_operations' from 'getstream/src/lib/client.js':

This is the code I’ve been using (obviously removed my key, secret and id):
var stream = require('getstream') var client = stream.connect('APP_KEY', 'APP_SECRET', 'APP_ID') var timeline_jack = client.feed('timeline', 'jack') timeline_jack.follow('user', 'bob')

I have tried running the example code in a blank node project and it works fine. The issue seems to be when I attempt to add it to my phoenix project.

Any thoughts?

Why you want to use a thrid party api to achieve something that you can handle with Phoenix? I don’t see the point…

Well First that error indicates that it is not able to find all its files, so however you got it seems to be the issue.

And Second, that looks like a node thing, not a phoenix thing. Node is only used (by default, optionally) by phoenix for Client side file creation, it does nothing server side, and this API looks like a server-side thing, not a client-side thing, yes?

Because NIH is a problem.

Maybe they plan on using it to make a POC. Maybe they already have an app built in another language that uses it, so they want to keep using it. There are many valid reasons OP may not want to write something like this themselves.

1 Like

True true this.

Which still brings up the point, it ‘looks’ like they are trying to use a node server api in an elixir server, those are incompatible server languages. ^.^;

Ahh that makes a lot of sense. I feel pretty stupid now for missing that.

I say this without having looked at the library, but presumably it is just an HTTP API. It should be easy enough for OP, or someone else, to create a simple wrapper for it.

Indeed yep, it would not be at all hard to port to an Elixir library from the looks of it. ^.^

For reference someone did it: https://github.com/seanmor5/stream_elixir
Also: https://github.com/sixFingers/streamex