embedly/embedly-node — Issue #3: Error: socket hung up
Author: robbiet480
Created: 2011-12-22 01:03:25+00:00
State: open

Using this code:

var method = 'oembed'
var embedly = require("embedly")

var api = new embedly.Api({'key': 'XXXXXXXXXXXX', 'host': 'api.embed.ly', 'user_agent': 'Mozilla/5.0 (compatible; EmbedAllTheThings-Server/1.0; me@robbiet.us)', 'force':'true'})
api.oembed({urls: ['http://vimeo.com/18150336']}).on('complete', function(objs) {
console.log(objs[0])
}).on('error', function(e) {
console.error(e)
}).start()

It will randomly work and randomly won't, throwing the following error:

[Thu, 22 Dec 2011 00:54:44 GMT] DEBUG Calling http://api.embed.ly:80/1/oembed?urls=http%3A%2F%2Fvimeo.com%2F18150336&key=XXXXXX

node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: socket hang up
at createHangUpError (http.js:1092:15)
at Socket. (http.js:1175:27)
at Socket.emit (events.js:88:20)
at Array.0 (net.js:300:10)
at EventEmitter._tickCallback (node.js:192:40)

The code in ./bin/embedly_oembed.js doesn't work all the time either, throwing the same error. I have tried both the version in NPM and the latest from git (which appears to be the same)