https://discord.cloudflare.com logo
Join Discord
Powered by
# workers-discussions
  • s

    stan

    02/20/2023, 7:22 AM
    😩
  • s

    stan

    02/20/2023, 7:23 AM
    will probably fall back to having a seperate worker handle all the image stuff and create a service binding to that
  • p

    PaganMuffin

    02/20/2023, 7:24 AM
    Try initializing wasm like here https://github.com/PaganMuffin/og-image-test Unless you already tried it
  • s

    stan

    02/20/2023, 7:24 AM
    i did, i was actually using your repo as reference
  • s

    stan

    02/20/2023, 7:27 AM
    good thing is, the perfomance difference asm.js and wasm versions of yoga as far as i can tell is unmeasurable
  • s

    stan

    02/20/2023, 7:27 AM
    will just have to delegate resvg stuff to an actual worker
  • s

    stan

    02/20/2023, 7:27 AM
    (unless i can get that working with asm.js too)
  • s

    stan

    02/20/2023, 7:33 AM
    (probably not)
  • h

    HardAtWork

    02/20/2023, 7:38 AM
    Are you on a custom domain?
  • s

    stan

    02/20/2023, 7:42 AM
    yes
  • h

    HardAtWork

    02/20/2023, 7:49 AM
    Kinda hacky, but you could just deploy the Worker right on top of where you want the WASM?
  • s

    stan

    02/20/2023, 7:50 AM
    you mean like, upload the wasm as a pages asset and fetch that from the function?
  • s

    stan

    02/20/2023, 7:50 AM
    (i tried that already 😩 )
  • h

    HardAtWork

    02/20/2023, 7:50 AM
    Are you doing the OG Image generator?
  • s

    stan

    02/20/2023, 7:51 AM
    well, i am doing og image generation, but not THE og image generator if you're reffering to something specific
  • h

    HardAtWork

    02/20/2023, 7:52 AM
    Create a regular Worker with the WASM bundled inside, then deploy it

    https://where.you.want/your/og/image.pngâ–¾

    (as a Worker route)
  • h

    HardAtWork

    02/20/2023, 7:53 AM
    Then you only incur the price of the Worker, and not also a Functions call
  • s

    stan

    02/20/2023, 7:55 AM
    hm, that's a possbiility
  • s

    stan

    02/20/2023, 10:17 AM
    after much work...

    https://731ae19e.blahaj-app.pages.dev/embed/og.pngâ–¾

  • s

    stan

    02/20/2023, 10:18 AM
    insanely hacky right now, mostly because i also had to patch wrangler to support service bindings in pages https://github.com/repository/blahaj-app/commit/5bfc010e61750fe0cf9ae7896f5f27d81918aa25
  • s

    stan

    02/20/2023, 10:21 AM
    only takes ~350ms so not too bad
  • u

    0xf

    02/20/2023, 12:19 PM
    @stan the avatar make me feel too much anxiety 😭, broken images is the worst things for a web dev
  • d

    Dementora_2

    02/20/2023, 2:57 PM
    hi every body can any one help me i want to convert a CF Worker code to netlify serverless function for Example i put two same code in cloudflare and netlify cloudflare: > > addEventListener('fetch', event => { > event.respondWith(handleRequest(event.request)) > }) > > async function handleRequest(request) { > const name = new URL(request.url).searchParams.get('name') || "World"; > return new Response(
    Hello, ${name}
    , {status: 200}) > } > same code in netlify: > > exports.handler = async (event, context) => { > const name = event.queryStringParameters.name || "World"; > > return { > statusCode: 200, > body:
    Hello, ${name}
    > }; > }; > is there any online converter for this job ? i want my CFworker code convert to the netlify serverless my code: > export default { > async fetch(req) { > try { > const url = new URL(req.url); > const splitted = url.pathname.replace(/^\/*/, '').split('/'); > const address = splitted[0]; > url.pathname = splitted.slice(1).join('/'); > url.hostname = address; > url.protocol = 'https'; > return fetch(new Request(url, req)); > } catch (e) { > return new Response(e); > } > } > };
  • d

    dave

    02/20/2023, 3:00 PM
    honestly try ChatGPT.
  • d

    Dementora_2

    02/20/2023, 3:02 PM
    i cant access to it
  • w

    Walshy | Pages

    02/20/2023, 3:22 PM
    \> Cloudflare Developers \> convert a CF Worker code to netlify serverless function
  • s

    Stigin

    02/20/2023, 3:32 PM
    LOl
  • s

    Stigin

    02/20/2023, 3:32 PM
    So i spun up a cloudflare worker
  • s

    Stigin

    02/20/2023, 3:32 PM
    random worker domain.
  • s

    Stigin

    02/20/2023, 3:32 PM
    within 10 minutes
1...229222932294...2509Latest