image icon indicating copy to clipboard operation
image copied to clipboard

Document SVG support for AWS Amplify

Open leynier opened this issue 1 year ago • 3 comments

PNG images work correctly. For example, for the file:

https://nuxt.educup.io/img/achievement-1.png

Through the image module, it also works correctly:

https://nuxt.educup.io/_amplify/image?url=/img/achievement-1.png&w=1280&q=100

But for the SVG file:

https://nuxt.educup.io/img/logo-white-tm.svg

The URL provided by the image module:

https://nuxt.educup.io/_amplify/image?url=/img/logo-white-tm.svg&w=1280&q=100

Raises the "SVG files are not allowed" error.

leynier avatar Dec 31 '23 09:12 leynier

This is probably related to dangerouslyAllowSVG params on https://docs.aws.amazon.com/amplify/latest/userguide/image-optimization.html

JhumanJ avatar Jan 05 '24 19:01 JhumanJ

Fixed with the right config:

export default defineNuxtConfig({
    nitro: {
        awsAmplify: {
            imageSettings: {
                dangerouslyAllowSVG: true
            }
        }
    }
})

JhumanJ avatar Jan 08 '24 19:01 JhumanJ

It works fine with that configuration, thanks a lot @JhumanJ

leynier avatar Jan 08 '24 21:01 leynier