boggin
boggin
Explore posts from servers
CDCloudflare Developers
Created by boggin on 7/22/2024 in #pages-help
dep problems sveltekit cloudflare-adapter when building
Found out the problem. For future searchers: You cannot use getPlatformProxy() outside of dev (specifically can't use outside of Node environmnets per the docs), so simply use a conditional dynamic import for dev.
if(dev){
const proxy = await getPlatformProxy();
if(dev){
const proxy = await getPlatformProxy();
3 replies
CDCloudflare Developers
Created by boggin on 7/22/2024 in #pages-help
dep problems sveltekit cloudflare-adapter when building
There's also about 8 similar errors with wrangler regarding using nodemodules
3 replies
CDCloudflare Developers
Created by boggin on 1/9/2024 in #general-help
Wasm problem with Sveltekit, Cloudflare Pages and Resvg.
Thank you James!
37 replies
CDCloudflare Developers
Created by boggin on 1/9/2024 in #general-help
Wasm problem with Sveltekit, Cloudflare Pages and Resvg.
Dude that worked!!! https://github.com/kvnang/workers-og Whatever magic they did to fit these all into the work under 1MB is magical. It's working as I intended to!
37 replies
CDCloudflare Developers
Created by boggin on 1/9/2024 in #general-help
Wasm problem with Sveltekit, Cloudflare Pages and Resvg.
? for me it says it can't exceed 1MB gzipped
37 replies
CDCloudflare Developers
Created by boggin on 1/9/2024 in #general-help
Wasm problem with Sveltekit, Cloudflare Pages and Resvg.
oh I see. Using a smaller svg would make this doable probably. Think this is the nail in the coffin then
37 replies
CDCloudflare Developers
Created by boggin on 1/9/2024 in #general-help
Wasm problem with Sveltekit, Cloudflare Pages and Resvg.
between satori and font buffers required for satori, I don't see how this would work. I really appreciate your time @James
37 replies
CDCloudflare Developers
Created by boggin on 1/9/2024 in #general-help
Wasm problem with Sveltekit, Cloudflare Pages and Resvg.
Ok well I'm assuming your code is working but I have other code problems. I'm assuming you're using this as a dynamic opengraph image generator right? if it's going into a meta tag, it has to be a url as far as I know, so how are you passing an SVG into the worker? putting the SVG would be too big for a search param, and I cant put satori into the worker because it exceeds the script limit on the worker.
37 replies
CDCloudflare Developers
Created by boggin on 1/9/2024 in #general-help
Wasm problem with Sveltekit, Cloudflare Pages and Resvg.
It's importing the wasm module fine, but ...uh how did you use it? cuz Resvg's docs say to the @resvg/resvg-wasm/index.js file to use the Resvg constructor and to initiate the wasm. If you have experience using this, what did you do?
37 replies
CDCloudflare Developers
Created by boggin on 1/9/2024 in #general-help
Wasm problem with Sveltekit, Cloudflare Pages and Resvg.
This is my first time using a standalone worker, a wasm, and resvg
37 replies
CDCloudflare Developers
Created by boggin on 1/9/2024 in #general-help
Wasm problem with Sveltekit, Cloudflare Pages and Resvg.
import { Resvg, initWasm } from '@resvg/resvg-wasm';
import resvgwasm from '@resvg/resvg-wasm/index_bg.wasm'

export default {
async fetch(request: Request): Promise<Response> {

const reqBody = await request.text();

await initWasm(resvgwasm)

const resvg = new Resvg(reqBody, {
fitTo: {
mode: 'width',
value: 1200
}
});
const image = resvg.render();

return new Response(image.asPng(), {
headers: {
'content-type': 'image/png'
}
});
},
};
import { Resvg, initWasm } from '@resvg/resvg-wasm';
import resvgwasm from '@resvg/resvg-wasm/index_bg.wasm'

export default {
async fetch(request: Request): Promise<Response> {

const reqBody = await request.text();

await initWasm(resvgwasm)

const resvg = new Resvg(reqBody, {
fitTo: {
mode: 'width',
value: 1200
}
});
const image = resvg.render();

return new Response(image.asPng(), {
headers: {
'content-type': 'image/png'
}
});
},
};
I get an error :
[wrangler:err] AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

(0, import_assert5.default)(prepareStackTrace !== void 0)

at getSourceMapper (C:\Users\...\node_modules\miniflare\dist\src\index.js:5749:30)
[wrangler:err] AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

(0, import_assert5.default)(prepareStackTrace !== void 0)

at getSourceMapper (C:\Users\...\node_modules\miniflare\dist\src\index.js:5749:30)
37 replies
CDCloudflare Developers
Created by boggin on 1/9/2024 in #general-help
Wasm problem with Sveltekit, Cloudflare Pages and Resvg.
@James So setup a separate worker. Having problems :
37 replies
CDCloudflare Developers
Created by boggin on 1/9/2024 in #general-help
Wasm problem with Sveltekit, Cloudflare Pages and Resvg.
and regarding Resvg in your worker, are importing like this?:
import { Resvg, initWasm } from '@resvg/resvg-wasm';
import resvgwasm from '@resvg/resvg-wasm/index_bg.wasm'
import { Resvg, initWasm } from '@resvg/resvg-wasm';
import resvgwasm from '@resvg/resvg-wasm/index_bg.wasm'
37 replies
CDCloudflare Developers
Created by boggin on 1/9/2024 in #general-help
Wasm problem with Sveltekit, Cloudflare Pages and Resvg.
Well to know that you can successfully import that wasm in a normal Worker is an enormous north star so thank you.
37 replies
CDCloudflare Developers
Created by boggin on 1/9/2024 in #general-help
Wasm problem with Sveltekit, Cloudflare Pages and Resvg.
In dev. havent tried deploying that. but dont know why this error would disappear
37 replies
CDCloudflare Developers
Created by boggin on 1/9/2024 in #general-help
Wasm problem with Sveltekit, Cloudflare Pages and Resvg.
yeah I get this error when importing '@resvg/resvg-wasm/index_bg.wasm'
Error: Cannot find module 'wbg' imported from 'C:/Users/.../node_modules/@resvg/resvg-wasm/index_bg.wasm'
Error: Cannot find module 'wbg' imported from 'C:/Users/.../node_modules/@resvg/resvg-wasm/index_bg.wasm'
I'm not using wrangler dev. just normal build with Vite, using the sveltekit adapter for cloudflare
37 replies
CDCloudflare Developers
Created by boggin on 1/9/2024 in #general-help
Wasm problem with Sveltekit, Cloudflare Pages and Resvg.
lemme try it and spit out the error
37 replies
CDCloudflare Developers
Created by boggin on 1/9/2024 in #general-help
Wasm problem with Sveltekit, Cloudflare Pages and Resvg.
Thank you, when I try that, i get some error with wbg which i know nothing about and it seems specific to how resvg is packing their wasm
37 replies
CDCloudflare Developers
Created by boggin on 12/1/2023 in #pages-help
sveltekit and node errors on build
Thank you. Thats quite frustrating. Digging through github issues trying to find options
7 replies
CDCloudflare Developers
Created by boggin on 12/1/2023 in #pages-help
sveltekit and node errors on build
I get these errors with pg ...
[ERROR] Could not resolve "events"
[ERROR] Could not resolve "stream"
[ERROR] Could not resolve "events"
[ERROR] Could not resolve "stream"
7 replies