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

    minester16

    03/10/2023, 11:17 AM
    Is node18 supported in workers? Is Node <18 requirement is just for pages?
  • t

    Tom Sherman

    03/10/2023, 11:18 AM
    workers don't run node.js, it's a different runtime (workerd). the Node 17 limitation on pages is for the build pipeline only, it doesn't run your app on node.js
  • m

    minester16

    03/10/2023, 11:19 AM
    Yeah sorry for mis-information. Can I build node 18 project in workers?
  • t

    Tom Sherman

    03/10/2023, 11:19 AM
    you can skip the Pages Node 17 constraint altogether by not using the build pipeline, and instead building yourself and pushing to pages via wrangler
  • m

    minester16

    03/10/2023, 11:19 AM
    okay thanks
  • m

    minester16

    03/10/2023, 11:19 AM
    you are right didn't thought about thatt
  • t

    Tom Sherman

    03/10/2023, 11:20 AM
    i think there is a new pages build images coming that'll support node 18 and lockfiles and a bunch of other improvements
  • e

    Epailes

    03/10/2023, 12:34 PM
    Was interesting looking through the launchpad demo day, the majority target developers rather than standard businesses (which I suppose makes sense for Cloudflare, I'd have thought they'd go for a wide variety), but what I found weird is there are 3 different members which are solely focussed on authentication
  • a

    Alisson Acioli

    03/10/2023, 1:31 PM
    Guys, when I test the worker with jest it seems to me that the type of test that is done is E2E. Would that be it? And if so, is there any way I can mock functions that ran in the worker before making the call to mock some behaviors?
  • v

    Vero 🐙

    03/10/2023, 1:56 PM
    the team is enabling for beta testing an updated build image to support node 18+, it's not the image v2 yet but it supports node 18
  • t

    Tom Sherman

    03/10/2023, 1:56 PM
    ah interesting! how can i signup? 😅
  • v

    Vero 🐙

    03/10/2023, 1:57 PM
    https://discord.com/channels/595317990191398933/1083706984949358692
  • s

    stan

    03/10/2023, 3:43 PM
    is there a suggested method of determining whether a request came from a service binding or not? need something reliable since i want to allow requests from other workers to bypass auth
  • k

    kian

    03/10/2023, 3:44 PM
    You can put something into the
    cf
    part of RequestInit and that'll be preserved which you can check in the bound Worker
  • s

    stan

    03/10/2023, 3:46 PM
    thanks, i’ll try that! 👍
  • d

    dave

    03/10/2023, 4:04 PM
    tbh depending on your situation, zipping files can be easier
  • s

    samdd

    03/10/2023, 4:54 PM
    reposting again as there's no response. Does anyone on the cloudflare workers team know why the runtime is panicking due to non-spec compliant JS issues https://canary.discord.com/channels/595317990191398933/1082037888184762408
  • k

    kian

    03/10/2023, 5:07 PM
    The runtime team is likely better reached via
  • s

    samdd

    03/10/2023, 5:12 PM
    thank you! i'll submit an issue
  • d

    DemosJarco

    03/10/2023, 6:42 PM
    running wrangler through
    unstable_dev
    for unit tests won't end on
    worker.stop()
    . Keeps about ~30 write streams open, preventing node script from ending
  • d

    DemosJarco

    03/10/2023, 6:44 PM
    log
  • d

    DemosJarco

    03/10/2023, 6:47 PM
    Basically the promise of
    stop()
    does resolve without error, but the server itself doesn't stop even after 6 hours (github actions terminates you after this).
  • s

    Skye

    03/10/2023, 7:11 PM
    Could you show how you're using
    worker.stop
    in your
    afterAll/afterEach
    ?
  • d

    DemosJarco

    03/10/2023, 7:12 PM
    https://github.com/demosjarco/local-ip-geo/blob/main/tests/index.test.ts#L14
  • s

    Skye

    03/10/2023, 7:12 PM
    Hmm
  • s

    Skye

    03/10/2023, 7:13 PM
    Could you try
    await worker.waitUntilExit()
    instead?
  • d

    DemosJarco

    03/10/2023, 7:15 PM
    running https://github.com/demosjarco/local-ip-geo/actions/runs/4387713341/jobs/7683334581
  • d

    DemosJarco

    03/10/2023, 7:16 PM
    Are you sure instead? Or how else will it know when to stop?
  • s

    Skye

    03/10/2023, 7:17 PM
    I've been using it in my tests, and the entire suite takes ~5s
  • d

    DemosJarco

    03/10/2023, 7:17 PM
    My test itself takes
    duration_ms: 2049.776648
    but the worker doesn't stop so the test script runs for infinity.
1...233323342335...2509Latest