itsthatguy / avatars-api-middleware

The express middleware for our avatars service
http://avatars.adorable.io
Other
749 stars 96 forks source link

Empty response from server #84

Closed kyh closed 5 years ago

kyh commented 5 years ago

I can't seem to get the middleware working. The response comes back empty: localhost_3000_avatars_abc localhost_3000_avatars_abc_and_server_js_ _test-avatar

Server setup:

import express from 'express';
import avatarsMiddleware from 'adorable-avatars';

const app = express();
app.use('/avatars', avatarsMiddleware);

app.listen(3000, () => {
  console.log(`Listening on port`, 3000);
});

Node version: v8.12.0

rylnd commented 5 years ago

@tehkaiyu thanks for the report! I'm able to reproduce this locally but I don't yet have a cause or solution. The current theory is that some dependency's behavior changed somehow (as this package hasn't changed since 0.2.1); we'll keep you posted.

kyh commented 5 years ago

Thank you! Happy to take a look this weekend as well

ihadeed commented 5 years ago

I had the same issue on my Ubuntu 18 server. It was missing GraphicsMagick and ImageMagick.

I fixed the issue by running these commands:

sudo add-apt-repository ppa:dhor/myway
sudo apt update
sudo apt install -y graphicsmagick build-essential && apt build-dep  -y imagemagick
wget -qO- http://www.imagemagick.org/download/ImageMagick.tar.gz | tar xzv
cd ImageMagick-*
./configure
make -j`nproc`
checkinstall
ldconfig /usr/local/lib
bigtiger commented 5 years ago

FWIW @ihadeed, GraphicsMagick should not be required. Imagemagick is however required. I've added a note to the README in #85.

rylnd commented 5 years ago

@tehkaiyu, installing imagemagick should address your issue; please reopen this PR if you continue to experience issues.

jrocha-dev commented 5 years ago

Same problem using the same code as @tehkaiyu . I'm using Node.js 10.11.0 (x64) and ImageMagick 7.0.8-12 (x64) in a machine with Windows 10.

jrocha-dev commented 5 years ago

Solved! Guys, I tried various versions of ImageMagic: Q8, Q16, static, dynamic as well different versions of Node.js. The solution was use GraphicsMagick (I'm using version 1.3.30 Q8 x64) 😃

rylnd commented 5 years ago

@josecprocha @tehkaiyu @ihadeed these seem to be issues with the gm package that we're using; it looks like behaviors are different for each OS. https://github.com/aheckmann/gm/issues/684 may be relevant for windows users; there are plenty of open issues to peruse :).

I've historically only used this library on OSX, and we've only needed a brew install imagemagick to get things working, but if you all wouldn't mind documenting what it takes to get things running on e.g. ubuntu and windows 10, that would be greatly appreciated. FWIW, the test suite npm test includes some integration tests that should be indicative of a good/bad setup of imagemagick/graphicsmagic.