# "Error While Saving Your Changes" with certain SVGs

**URL:** <https://community.prismic.io/t/error-while-saving-your-changes-with-certain-svgs/2765>\
**Category:** Prismic for Content Creators\
**Created:** [November 19, 2020, 12:39pm UTC](https://community.prismic.io/t/error-while-saving-your-changes-with-certain-svgs/2765 "2020-11-19T12:39:38Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![joe.reed](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@joe.reed](https://community.prismic.io/u/joe.reed)\
**Post date:** [November 19, 2020, 12:39pm UTC](https://community.prismic.io/t/error-while-saving-your-changes-with-certain-svgs/2765/1 "2020-11-19T12:39:38Z")

</div>

I have created a new custom type with an image field.

When I try to use certain SVGs in the field I am unable to save the document.

I thought this thread may have been related: [How to upload and use SVG?](https://community.prismic.io/t/how-to-upload-and-use-svg/894)

But this error is consistent across both Firefox and Chrome.

---

<div class="post-metadata">

**Author:** ![joe.reed](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@joe.reed](https://community.prismic.io/u/joe.reed)\
**Post date:** [November 19, 2020, 12:45pm UTC](https://community.prismic.io/t/error-while-saving-your-changes-with-certain-svgs/2765/2 "2020-11-19T12:45:35Z")

</div>

After further investigation, it seems to be linked to whether or not there are explicit `width` and `height` properties on the svg. When missing, the error is triggered.

---

<div class="post-metadata">

**Author:** ![joe.reed](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@joe.reed](https://community.prismic.io/u/joe.reed)\
**Post date:** [November 19, 2020, 12:52pm UTC](https://community.prismic.io/t/error-while-saving-your-changes-with-certain-svgs/2765/3 "2020-11-19T12:52:19Z")

</div>

Workaround is to ensure there are explicit `width` _and_ `height` properties on your svg.

When either is missing then that dimension is registered as 0px and results in a 400 error when trying to save the document. Would be really helpful if Prismic could add in a more helpful error here, even saying which field was preventing the save would have saved me a lot of time.

---

<div class="post-metadata">

**Author:** ![Fares](https://avatars.discourse-cdn.com/v4/letter/f/71e660/32.png) [@Fares](https://community.prismic.io/u/Fares)\
**Post date:** [November 19, 2020, 1:52pm UTC](https://community.prismic.io/t/error-while-saving-your-changes-with-certain-svgs/2765/4 "2020-11-19T13:52:16Z")

</div>

Hi Joe,

Welcome to the Prismic community,  
Thanks for sharing the workaround but in order to investigate this issue, can you please share with us the name of your repository (in a private message if necessary).

As well as the SVG you are trying to upload?

It would be also useful if you can add a screenshot of the error you get, and if you are a developer the error you get in your browser console.

Looking forward to your reply,  
Fares

---

<div class="post-metadata">

**Author:** ![joe.reed](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@joe.reed](https://community.prismic.io/u/joe.reed)\
**Post date:** [November 19, 2020, 2:32pm UTC](https://community.prismic.io/t/error-while-saving-your-changes-with-certain-svgs/2765/5 "2020-11-19T14:32:39Z")

</div>

Hi @Fares,

Thanks for getting back to me.

Created a test repository at `svgtest.prismic.io`

Two SVGs attached that are identical except one has `width/height` properties and the other doesn't.  
[Test SVGs.zip](https://community.prismic.io/uploads/short-url/j7EBcWZeqRC3DBgyjhUVWYRBkjc.zip) (919 Bytes)

When I save the document with the SVG with no dimensions selected in the image field, all I get is a 400 response in the console.

 ![Screenshot 2020-11-19 at 14.28.30](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/2/2c67071e39a707545f4522c45ff7d1f321a5e489.png)

When I save the document with the other SVG selected, the document saves.

---

<div class="post-metadata">

**Author:** ![Fares](https://avatars.discourse-cdn.com/v4/letter/f/71e660/32.png) [@Fares](https://community.prismic.io/u/Fares)\
**Post date:** [November 19, 2020, 3:58pm UTC](https://community.prismic.io/t/error-while-saving-your-changes-with-certain-svgs/2765/7 "2020-11-19T15:58:43Z")

</div>

Hi,  
I've tried to reproduce the issue on my repository and I was able to upload save and publish both SVGs as shown

 ![Screenshot 2020-11-19 at 16.56.12](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/f/f1b55a354ecd20ff1c3de87f11b09acb41817b82.png)

I will try to clone this test repo you have created to reproduce the issue.

---

<div class="post-metadata">

**Author:** ![joe.reed](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@joe.reed](https://community.prismic.io/u/joe.reed)\
**Post date:** [November 19, 2020, 4:03pm UTC](https://community.prismic.io/t/error-while-saving-your-changes-with-certain-svgs/2765/8 "2020-11-19T16:03:08Z")

</div>

That's interesting! When I upload the svg with no dimensions, the preview shows me "0 x 0px"

---

<div class="post-metadata">

**Author:** ![Fares](https://avatars.discourse-cdn.com/v4/letter/f/71e660/32.png) [@Fares](https://community.prismic.io/u/Fares)\
**Post date:** [November 19, 2020, 4:04pm UTC](https://community.prismic.io/t/error-while-saving-your-changes-with-certain-svgs/2765/9 "2020-11-19T16:04:43Z")

</div>

It seems that issue due to a browser issue in Firefox as far as I remember and seem a duplicate of the thread

> [@How to upload and use SVG?](https://community.prismic.io/t/how-to-upload-and-use-svg/894/8):
>
> okay that’s weird! the repo name is truetapegermany thanks! please give me an update once we know what’s going on here.

I've tried the repo you have shared and I see the error but when I upload them again using chrome it works.

---

<div class="post-metadata">

**Author:** ![joe.reed](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@joe.reed](https://community.prismic.io/u/joe.reed)\
**Post date:** [November 19, 2020, 4:17pm UTC](https://community.prismic.io/t/error-while-saving-your-changes-with-certain-svgs/2765/10 "2020-11-19T16:17:41Z")

</div>

I still get this issue on Chrome in my test repo.

![Screenshot 2020-11-19 at 16.17.04](https://europe1.discourse-cdn.com/flex013/uploads/prismic/original/2X/c/c6a80cb2aa2683d97c11d8a9a827204f5df79491.png)

---

<div class="post-metadata">

**Author:** ![joe.reed](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@joe.reed](https://community.prismic.io/u/joe.reed)\
**Post date:** [November 19, 2020, 4:18pm UTC](https://community.prismic.io/t/error-while-saving-your-changes-with-certain-svgs/2765/11 "2020-11-19T16:18:32Z")

</div>

Ah! My bad, that was using the asset uploaded through Firefox.

---

<div class="post-metadata">

**Author:** ![joe.reed](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@joe.reed](https://community.prismic.io/u/joe.reed)\
**Post date:** [November 19, 2020, 4:22pm UTC](https://community.prismic.io/t/error-while-saving-your-changes-with-certain-svgs/2765/12 "2020-11-19T16:22:21Z")

</div>

So to summarise: SVGs without width/height properties when uploaded through Firefox cannot be saved in documents (in any browser). So there appears to be an issue with the file upload process.

---

<div class="post-metadata">

**Author:** ![joe.reed](https://avatars.discourse-cdn.com/v4/letter/j/df788c/32.png) [@joe.reed](https://community.prismic.io/u/joe.reed)\
**Post date:** [November 19, 2020, 4:33pm UTC](https://community.prismic.io/t/error-while-saving-your-changes-with-certain-svgs/2765/13 "2020-11-19T16:33:57Z")

</div>

Okay _here_ is the bug in Firefox:

> **[700533 - drawImage() fails silently when drawing an SVG image without @width...](https://bugzilla.mozilla.org/show_bug.cgi?id=700533)**
>
> NEW (nobody) in Core - SVG. Last updated 2020-08-17.

---

<div class="post-metadata">

**Author:** ![Pau](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/pau/32/5422_2.png) [@Pau](https://community.prismic.io/u/Pau)\
**Post date:** [December 22, 2020, 12:13am UTC](https://community.prismic.io/t/error-while-saving-your-changes-with-certain-svgs/2765/14 "2020-12-22T00:13:43Z")

</div>

closed on December 22, 2020, 12:13am UTC, flag & select 'Something Else' to reopen.

This issue has been closed due to inactivity. [Flag to reopen](https://community.prismic.io/t/re-open-a-thread/2175).

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/flex013/user_avatar/community.prismic.io/system/32/1746_2.png) [@system](https://community.prismic.io/u/system)\
**Post date:** [December 9, 2021, 12:56pm UTC](https://community.prismic.io/t/error-while-saving-your-changes-with-certain-svgs/2765/15 "2021-12-09T12:56:19Z")

</div>

Opened on December 9, 2021, 12:56pm UTC


