question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error with SVG Input buffer on zeit/now platform

See original GitHub issue

First of all, thanks for this great and useful module!

Description

This code essentially converts an svg String into Buffer to pass as input to sharp and then obtain its png output, works as expected.

Something like:

const src = `<svg>…</svg>`
const buff = Buffer.from(src)
sharp(buff).toBuffer().then(data => console.log(data))

Expected behaviour

Running it in my local machine works as expected: sharp1

Local machine is Max OS X El Capital (10.11.6)

Works well also in another computer Ubuntu 16.04.3.

Problem

I am trying to deploy a microservice that use at some point similar code of this reproduction, and love the simplicity of now, but when deploying it doesn’t work as expected. Returns:

Error: Input buffer contains unsupported image format

sharp2

Repo

I created a repository with the simplest code I found break the functionality here: https://github.com/elrumordelaluz/sharp-test The endpoint deployed using now is https://sharp-test.now.sh/

Please, let me know if you think is a issue related on now platform or deployment process instead if sharp.

Thanks in advance and congrats for the great work!

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
TooTallNatecommented, Dec 15, 2017

The version of libvips on ZEIT Now includes SVG input support now. I believe this issue can be closed.

1reaction
lovellcommented, Dec 11, 2017

Thanks, this confirms that zeit/now provides a globally-installed libvips v8.5.8 that has been compiled without SVG support. You’ll need to take this one up with them, good luck!

Read more comments on GitHub >

github_iconTop Results From Across the Web

SVG as SVG's image tag not working while using with sharp
It looks like sharp does not handle external images well. You can try to "flatten" SVG before passing it to sharp .
Read more >
Og/twitter previews not working - Netlify Support Forums
Twitter card validator is working fine, but i get no previews while sharing on whatsapp or anywhere else (including twitter). But it works...
Read more >
<yuri-gor/> – Your code is clear.
Lambda functions at zeit/now v2 platform have default execution timeout 10s. ... req.end(() => { console.log("NOW it's not λ1's problem anymore.
Read more >
Archive - PSPDFKit
PSPDFKit is the best framework for working with PDF files. Our SDK provides first-rate PDF solutions for your application with features like annotating, ......
Read more >
Rhythm & Binary
This required a lot of trial and error to get it to work with my DHT11 sensor. ... The relay controls the circuit,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found