-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
gatsby-plugin-sharp tracedSVG crashes build #8301
Comments
@tylermenezes can you provide a reproduction repo for this? That would make it much easier to diagnose this issue. |
I can confirm the same error message in our project. The difference is that I haven't been able to fully isolate the issue on my part yet. Though this issue is so far the only one, that might give me a hint on the issue. |
Hmmmm, I just changed the extension of one of the @JanneVincit Are you also experiencing this in the context of Contenful like @tylermenezes? |
Renaming the file from .jpeg -> .jpg in Contentful was the solution which solved my problem, but the error message is extremely generic, and when I looked into the code while trying to troubleshoot, it seems like any error will result in this message. A better solution is probably to improve the error message quality, but IIRC that requires a fix from both Gatsby and Potrace. |
@tylermenezes Totally agree that error messages need to be improved here! Didn't want to take away from that with my comment — just wanted to make sure that this is only happening in the context of Contentful. |
@fk Sorry for not being more explicit. Yes it happens in the context of contentful. We are actually not in production with this yet (though the code is ready, but this doesn't make me trust the implementation, so haven't gone to production yet). Our issue is probably something else than the jpeg-issue @tylermenezes was experiencing. But as tyle pointed out, the error is quite generic and could be caused by something else too. |
Still having the issue here. Happens on Netlify but not on local. Hard to pinpoint the problem. EDIT: 4 Feb. 2018: Starting to have the issue on local builds also. Intermittently for no apparent reasons. |
@dotlouis Hi, i'm having the same problem when deploying to Netlify, have you find a solution ? |
@dotlouis @Damex989 Because the error message is super generic, it's hard to tell what "the problem" is. If you're having a problem on Netlify but not on local builds, it's likely a different error entirely. What has changed since the last successful build? Not just code-wise, but also in the CMS? If you can help narrow the problem down I might be able to help figure out what's causing your particular error. |
@tylermenezes Thank you for the response, it's going to sound weird but sometimes it builds correctly sometimes not, i'm using Contentful - Gatsby - Netlify, and i think it's the same error you mentioned at the beginning
|
It's definitely the same error, but as I mentioned, that error message is very generic, and it's probably not the same cause. If it were the exact problem I had, with .jpeg files on Contentful, it would fail 100% of the time in all environments. That error basically just means "could not read the source file for some reason" -- could be that the file extension/mime-type is wrong, something in the file header is messed up, the file didn't download properly because of network issues, ... Is the failing build only happening on Netlify, or locally as well? If it's only on Netlify, you'd need to figure out what's changing in the environment between successful and failing builds. If you noticed when you started having this problem, you may also be able to figure it out yourself. |
Some debugging by @fk led to some useful insights.
So what I'd propose we do here is (in order of quick wins, but not necessarily fixing the underlying issue):
What will really help in this issue is if there's anyone who is able to reproduce, even intermittently. I've attempted to reproduce with this repo and this Netlify build but no luck as of yet. |
I had been getting this same error intermittently on Netlify builds only.
Removing tracedSVG from my graphQL queries "fixed" it for me for now. (I don't have any files ending in jpeg however, only png and jpg) |
the title is misleading because it isn't the jpeg extension that causes the errors (maybe file size?) On my blog-posts page I had many jpeg files and it works without any problems but it crashes on the post pages… tried to filter with graphql the jpg and/or jpeg files but it still crashed (I didn't have jpg files on my blog-posts page so I thought it could be the problem but it's not) If anybody know anything new according to this problem we are all ears 😄 |
I spotted this exact issue on CI job, an example failure is here https://circleci.com/gh/ertrzyiks/yummy/51 Still, it's quite far from repro steps, I wasn't able to narrow it down yet. I can try to debug it if it's reproducible after enabling the cache back. |
Yeah this is unfortunately not a production ready solution... :/ On a blog with over 300 Posts the build time would radically increase :( |
Same as @DanielAlejandroMontesRodriguez, I'm using Gatsby + Contentful and deploying to Netlify. Locally, the builds are running fine all the time, but on Netlify I kept getting the same error that @tylermenezes originally reported. I followed @alisonjoseph's advice and replaced all my |
Anecdotally, I've been seeing this issue arise when using a larger |
Seems like a duplicate of #12552? |
I opened #12927 PR that hopefully fixes that. Because of random nature of this errors I can't be 100% sure on this |
… times at a same time (#12927) Memoization key for tracedSVG was not entirely correct and we were trying to write to temporary file multiple times. This was causing those temporary files to become corrupted in dependencies of `potrace` were crashing while trying to read those corrupted input files (there was a lot of concurrency, so that's why those crashes were very random - sometimes timing was bad and we would end up . This _should_ fix memoization key and avoid writing to same file more than once - there is also extra memoization layer just for that, so if general memoization key for `traceSVG` function fails, there is another memoization that checks just temporary file location. This was happening most likely when there were copies of same image in multiple places (as memoization key was using `absolutePath` before). I've moved some code around (mostly because I needed to export some trace SVG related functions for added tests). I'll try to mark places in removed code that did change. related issue #8301
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! Thanks for being a part of the Gatsby community! 💪💜 |
Update on this that I forgot to mention before: |
I just stumbled upon this issue while looking for a resolution. Intermittently getting it with |
As above I'm still getting this, not sure what is meant with the replacement solution? 3:58:27 PM: success extract queries from components — 0.200 s
3:58:29 PM: error UNHANDLED EXCEPTION
3:58:29 PM:
3:58:29 PM: TypeError: Cannot read property 'bitmap' of undefined
3:58:29 PM:
3:58:29 PM: - Potrace.js:1000 Potrace._processLoadedImage
3:58:29 PM: failed during stage 'building site': Build script returned non-zero exit code: 1
3:58:29 PM: [repo]/[potrace]/lib/Potrace.js:1000:35
3:58:29 PM:
3:58:29 PM: - Potrace.js:1046 Jimp.<anonymous>
3:58:29 PM: [repo]/[potrace]/lib/Potrace.js:1046:14
3:58:29 PM:
3:58:29 PM: - index.js:85 Jimp.throwError
3:58:30 PM: Shutting down logging, 36 messages pending
|
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m As a friendly reminder: the best way to see this issue, or any other, fixed is to open a Pull Request. Check out gatsby.dev/contribute for more information about opening PRs, triaging issues, and contributing! Thanks again for being part of the Gatsby community! |
We're having the same issue with Contentful, it happens on png images as well
|
You should open a brand new issue, as this seems unrelated. The error message for this is "Cannot read property 'bitmap' of undefined". |
We've had the same issue. When using
For now removing all the tracedSVG instances fixes the build but does dampen the site experience by quite a lot. I will also edit the title of this issue as it is not specific to .jpeg extensions. |
I'm facing this issue too. Using Gatsby + Netlify + Contentful. It happens at random though.
On netlify, I get
|
Going to close this issue. There have been many changes to Sharp and friends since this was opened and I feel this issue is no longer applicable to the current version of Gatsby. If you're still seeing this issue or something that looks like something that was reported here, please open a new, specific, issue about it. And please look to confirm whether there isn't an open issue about it already. Thanks for all your inputs |
Description
Using tracedSVG on a file ending in .jpeg causes gatsby-plugin-sharp to report the following vague error:
Of note, Twitter always uses .jpeg for its image suffix, so any images saved from Twitter will crash tracedSVG.
Steps to reproduce
tracedSVG
Expected result
Actual result
Vague error message.
Environment
The text was updated successfully, but these errors were encountered: