vercel / satori

Enlightened library to convert HTML and CSS to SVG
https://og-playground.vercel.app
Mozilla Public License 2.0
11.08k stars 243 forks source link

Non emoji unicode symbols crash the server #272

Open MillHaus33 opened 2 years ago

MillHaus33 commented 2 years ago

Bug report

Whenever a symbol like ✪ exists in the html the image is not generated

Expected Behavior

Either render the symbol or allow the image to be created without it

MillHaus33 commented 1 year ago

@shuding

i have updated vercel/og and am using satori 0.0.44, but unable to get this to work.

do i need to include any specific fonts in my options to be able to leverage this? attempting the example in #286 on my server will not render and i receive the open htm error

return new ImageResponse(
        (
            <div
                style={{
                    height: '100%',
                    width: '100%',
                    display: 'flex',
                    flexDirection: 'column',
                    alignItems: 'center',
                    justifyContent: 'center',
                    backgroundColor: '#fff',
                    fontSize: 32,
                    fontWeight: 600,
                }}
            >
                <svg width="75" viewBox="0 0 75 65" fill="#000" style={{ margin: '0 75px' }}>
                    <path d="M37.59.25l36.95 64H.64l36.95-64z"></path>
                </svg>
                <div style={{ marginTop: 40 }}>✪ 🝳 → ☻, 𝖒 ℯ ℝ ℵ</div>
            </div>
        ),
        { height: 1200, width: 630 }
    );

below are my versions

satori@0.0.44:
  version "0.0.44"
  resolved "https://registry.yarnpkg.com/satori/-/satori-0.0.44.tgz#278d2c383a3248973c93843c0f72da5c69c9eafa"
  integrity sha512-WKUxXC2qeyno6J3ucwwLozPL6j1HXOZiN5wIUf7iqAhlx1RUC/6ePIKHi7iPc3Cy6DYuZcJriZXxXkSdo2FQHg==
  dependencies:
    "@shuding/opentype.js" "1.4.0-beta.0"
    css-background-parser "^0.1.0"
    css-box-shadow "1.0.0-3"
    css-to-react-native "^3.0.0"
    emoji-regex "^10.2.1"
    postcss-value-parser "^4.2.0"
    yoga-layout-prebuilt "^1.10.0"
"@vercel/og@^0.0.21":
  version "0.0.21"
  resolved "https://registry.yarnpkg.com/@vercel/og/-/og-0.0.21.tgz#9d2421a241a0cfbdc3841b88bf323d980339da40"
  integrity sha512-WgMahG5c8UM7xtn/mT+ljUpDMSDnSlu8AXL52JtTwxb1odrd0GWqZg2N1X38wulPj+sCccNpDdFmmAuw0GLc+Q==
  dependencies:
    "@resvg/resvg-wasm" "2.0.0-alpha.4"
    satori "0.0.44"
    yoga-wasm-web "0.1.2"