Open didier opened 4 months ago
@didier please open a ticket in svelte-h2j. BTW it's coming soon.... I have a v5 implementation ready, testing pending.
Anything I can do to help test? I'm kind of blocked with my v5 migration.
@didier You can test it by updating etherCorps/sveltekit-og
to next
version. It's works on vercel. I did make API changes so please check https://github.com/etherCorps/sveltekit-og/tree/main/src/routes
for new examples. I did it kinda and make a mess of merging it into main. But you can now use v5
. I'll fix other issues.
That seems to work, thanks! Testing prod now.
One thing, an error is thrown if no props
object is passed to ImageResponse
. Adding an empty object resolves it, but would be nice if the argument is completely optional.
I was working on a different implementation based on vue og images but when I saw ur comment i just did a patch work in the last implementation to release for test.
So far, prod on Vercel doesn't seem to work, but I don't get any errors in my logs either. Will investigate.
Test 1: https://sveltekit-og.ethercorps.io/ - With html string Test 2: https://sveltekit-og.ethercorps.io/sc - With Svelte Component
Vercel Exampes Project - https://github.com/etherCorps/sveltekit-og/tree/main/examples/vercel-build Test 1: https://sveltekit-og-vercel.vercel.app/ - html string Test 2: https://sveltekit-og-vercel.vercel.app/cog - Svelte Component
This lib works in server side only.
The two tests look inconsistent. Is that intended?
EDIT: So just to be 100% sure, @resvg-js
is no longer a peer dep?
@resvg-js is no longer a peer dep? What do you mean by this? The two tests look inconsistent. Is that intended? They might be different but still works. But it also depends on what you are referring as inconsistent
Well I get some warnings about @resvg-js possibly not being found on the server:
Warning: The following modules failed to locate dependencies that may (or may not) be required for your app to work:
node_modules/@resvg/resvg-js/js-binding.js
- /vercel/path0/node_modules/@resvg/resvg-js/resvgjs.android-arm64.node
- /vercel/path0/node_modules/@resvg/resvg-js/resvgjs.android-arm-eabi.node
- /vercel/path0/node_modules/@resvg/resvg-js/resvgjs.win32-x64-msvc.node
- /vercel/path0/node_modules/@resvg/resvg-js/resvgjs.win32-ia32-msvc.node
- /vercel/path0/node_modules/@resvg/resvg-js/resvgjs.win32-arm64-msvc.node
- /vercel/path0/node_modules/@resvg/resvg-js/resvgjs.darwin-universal.node
- /vercel/path0/node_modules/@resvg/resvg-js/resvgjs.darwin-x64.node
- /vercel/path0/node_modules/@resvg/resvg-js/resvgjs.darwin-arm64.node
- /vercel/path0/node_modules/@resvg/resvg-js/resvgjs.freebsd-x64.node
- /vercel/path0/node_modules/@resvg/resvg-js/resvgjs.linux-x64-musl.node
- /vercel/path0/node_modules/@resvg/resvg-js/resvgjs.linux-x64-gnu.node
- /vercel/path0/node_modules/@resvg/resvg-js/resvgjs.linux-arm64-musl.node
- /vercel/path0/node_modules/@resvg/resvg-js/resvgjs.linux-arm64-gnu.node
- /vercel/path0/node_modules/@resvg/resvg-js/resvgjs.linux-arm-gnueabihf.node
- /vercel/path0/node_modules/@resvg/resvg-js/resvgjs.linux-riscv64-musl.node
- /vercel/path0/node_modules/@resvg/resvg-js/resvgjs.linux-riscv64-gnu.node
- /vercel/path0/node_modules/@resvg/resvg-js/resvgjs.linux-s390x-gnu.node
- @resvg/resvg-js-android-arm64
- @resvg/resvg-js-android-arm-eabi
- @resvg/resvg-js-win32-x64-msvc
- @resvg/resvg-js-win32-ia32-msvc
- @resvg/resvg-js-win32-arm64-msvc
- @resvg/resvg-js-darwin-universal
- @resvg/resvg-js-darwin-x64
- @resvg/resvg-js-darwin-arm64
- @resvg/resvg-js-freebsd-x64
- @resvg/resvg-js-linux-arm64-musl
- @resvg/resvg-js-linux-arm64-gnu
- @resvg/resvg-js-linux-arm-gnueabihf
- @resvg/resvg-js-linux-riscv64-musl
- @resvg/resvg-js-linux-riscv64-gnu
- @resvg/resvg-js-linux-s390x-gnu
node_modules/ws/lib/buffer-util.js
- bufferutil
node_modules/ws/lib/validation.js
- utf-8-validate
Warning: The following modules failed to locate dependencies that may (or may not) be required for your app to work:
node_modules/ws/lib/buffer-util.js
- bufferutil
node_modules/ws/lib/validation.js
- utf-8-validate
I meant inconsistent as in, they seem to try to render the same image, but the output looks different
Either way, I'm not getting any errors (even with debug: true
), but it doesn't seem to be working... I'm not doing anything fancy either, just an HTML string passed into ImageResponse
.
Can you provide me a repro for this anywhere with source? I'll try to help you.
https://github.com/didier/sveltekit-og-repro https://sveltekit-og-repro.vercel.app
Here you go. I should say, I'm now getting errors, even in development.
Cannot find module 'estree-walker' imported from '/Users/didier/Projects/[redacted]/sveltekit-og-repro/node_modules/@ethercorps/svelte-h2j/dist/toReactElement.js'
Error: Cannot find module 'estree-walker' imported from '/Users/didier/Projects/[redacted]/sveltekit-og-repro/node_modules/@ethercorps/svelte-h2j/dist/toReactElement.js'
at nodeImport (file:///Users/didier/Projects/[redacted]/sveltekit-og-repro/node_modules/vite/dist/node/chunks/dep-DEPSZ3SS.js:56268:25)
at ssrImport (file:///Users/didier/Projects/[redacted]/sveltekit-og-repro/node_modules/vite/dist/node/chunks/dep-DEPSZ3SS.js:56177:30)
at eval (/Users/didier/Projects/[redacted]/sveltekit-og-repro/node_modules/@ethercorps/svelte-h2j/dist/toReactElement.js:4:37)
at async instantiateModule (file:///Users/didier/Projects/[redacted]/sveltekit-og-repro/node_modules/vite/dist/node/chunks/dep-DEPSZ3SS.js:56237:9
Installing estree-walker
as a dependency resolves the error, but does not make the OG image work.
Deployment also shouts about peerDependencies
I still think the issue is somehow in how resvg-js is used. Every time I build it warns about it not being found, and since it's in Rust, we won't get any errors in JS land. Installing it separately does not resolve the issue either.
I still think the issue is somehow in how resvg-js is used
In new implementation that's what i'm trying to handle so i sveltekit-og
can be runtime agnostic.
Every time I build it warns about it not being found, and since it's in Rust, we won't get any errors in JS land. Installing it separately does not resolve the issue either.
Ok, I'm testing it now. Give me some time
@didier brother you and me missed flex on div
. If you remember satori uses yoga which is an implementation of flex box.
Does not putting flex on the div completely kill the generation without error? 🤔🤔
Yes, you can find something related to this in satori issues.
With Svelte 5 around the corner, it'd be awesome if we could update this to support Svelte versions above 4.X. Currently unable to build my site since
sveltekit-og
relies on a peer dependency of^4.0.0
.