-
Notifications
You must be signed in to change notification settings - Fork 284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webshot from URL on Heroku not working #25
Comments
FYI figured this out. It'd be worth adding a note to the Readme that getting this running on Heroku requires a bit of extra configuration. Roughly I had to do the following to get webshots to work on heroku:1. Use the multip-buildpack buildpack 2. Add nodejs and phantomjs buildpacks to
This tells Heroku to use the standard nodejs buildpack AND the phantomjs buildpack 3. Add Heroku config variables
4. Set the If a version number is returned, then you can add this path to your webshot config,
5. Deploy to heroku 6. Test!!! References
Hope this helps someone in the future! |
Hi facultymatt, Wow, thanks so much for creating that guide. I've never used Heroku so I'm glad you were able to get the issue worked out. I'll add a link from the readme. |
BTW, it's |
If anyone is still watching this issue, can you help me with where heroku stores the screenshots taken via webshots? |
@ksprashu did you figure it out? |
@ksprashu @fivepointseven: It may be that heroku doesn't allow writing files to the filesystem. However, you can put the contents into a database, or send as a response to a web request. I am actually putting the image into a pdf. If your second argument is an options object, and your callback has two arguments, the second callback argument will be a stream which you can work with. Here is an example of converting the stream into a buffer: webshot(url, options, function (err, renderStream) {
var imageBuffers = [];
renderStream.on('data', function (data) {
imageBuffers.push(data);
});
renderStream.on('end', function () {
var imageBuffer = Buffer.concat(imageBuffers);
// Do something with your buffer (imageBuffer);
});
}); |
@fivepointseven @ismyrnow My calls were not failing (as per the logs) but there was no way I could retrieve them back from Heroku. What I did then was to use the dropbox APIs and just save the image directly to dropbox. Then I could sync and retrieve them later. |
Hello, I've tried with no success to get webshot to work on Heroku. Oddly, it works fine locally and when running
foreman start
(which should emulate Heroku.) Here are some more details:I've used a few variations of your examples and code I've found online. I can post code samples here if needed, but maybe you have more insight into Heroku?
I've seen mention online to a custom buildpack, is this needed?
Thanks,
-Matt
The text was updated successfully, but these errors were encountered: