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

    paras

    03/30/2023, 4:55 PM
    Thank you for everyone who helped with this. We really appreciate and are thankful for the prompt resolution from everyone involved.
  • z

    zizi

    03/30/2023, 5:26 PM
    opentelemetry in worker?
  • k

    Klowner

    03/30/2023, 5:38 PM
    I have also had these same questions, I haven't managed to find much/any clear documentation on how the isolates work in regards to quotas and such
  • k

    kian

    03/30/2023, 5:41 PM
    Isolates in general or specifically for Service Bindings?
  • k

    kian

    03/30/2023, 5:53 PM
    Each request has it's own CPU limit, and the isolate has a memory limit - concurrent requests will be sharing the same memory, so using 80MB might be okay for a single request but as soon as there's two at the same time, expect exceptions. If you're using all Unbound in your Service Binding chain, you get a flattened duration since Worker A's CPU isn't idle as it's working on Worker B's response. If you're using Bundled anywhere then it's a new request and it gets 50ms of CPU time. Memory limits have some grace, as there's a soft eviction if you go slightly over and a hard eviction if you go way over - you can read up on it at https://www.infoq.com/presentations/cloudflare-v8/ which is also a pretty cool resource for the implementation details of Workers in general.
  • k

    kian

    03/30/2023, 5:58 PM
    You can also read into a bit of
    workerd
    if you feel like it - i.e
  • k

    kian

    03/30/2023, 5:59 PM
    It'll only go so far though - the limit enforcer isn't OSS
  • a

    add-IV

    03/30/2023, 6:04 PM
    Hello everyone, I am currently building a website with sveltekit and had some builds on cloudflare pages fail because I imported a file called logo.png while the source file was called logo.PNG (with the extension in uppercase). Building locally and running dev worked but when I deployed to pages vite build failed with: > [vite:asset] Could not load /path/to/logo.png Not quite sure if this is intended so I thought I should bring it up here. Changing the file extension to lowercase fixed the issue.
  • j

    James

    03/30/2023, 6:05 PM
    Are you perhaps developing on a system that allows case-insensitive filenames (windows, mac)?
  • a

    add-IV

    03/30/2023, 6:05 PM
    yup
  • j

    James

    03/30/2023, 6:05 PM
    Linux generally uses a case-sensitive filesystem, which is what Pages uses to build
  • j

    James

    03/30/2023, 6:06 PM
    I would recommend you make the dir/filesystem you're developing in case-sensitive - all modern OS versions have ways to do this
  • m

    Matt

    03/30/2023, 8:46 PM
    I'm mainly using the serverless function to pull static data for a data visualization web app.
  • e

    Erwin

    03/30/2023, 9:48 PM
    Yup 😆
  • g

    GeorgeTailor

    03/30/2023, 10:03 PM
    is there some sort of a restriction on what error codes the worker can return? When I return 403 response code the logs say that it returns 403, but the actual response is never returned to the browser, when I return 204 it works just fine.
  • e

    Erisa | Support Engineer

    03/30/2023, 10:05 PM
    You should be able to return 403 no problem, are you seeing anything in the worker logs or?
  • g

    GeorgeTailor

    03/30/2023, 10:06 PM
    POST /api/document/upload 401 Unauthorized (5.87ms)
    or
    POST /api/document/upload 403 Forbidden (9.48ms)
    I try to upload a file and when a user is not authenticated or does not have sufficient rights I return respective codes
  • g

    GeorgeTailor

    03/30/2023, 10:07 PM
    when I try to download the file 401 works fine
  • g

    GeorgeTailor

    03/30/2023, 10:07 PM
    so I'm kind of puzzled
  • g

    GeorgeTailor

    03/30/2023, 10:07 PM
    is it FormData that somehow affects the worker?
  • g

    GeorgeTailor

    03/30/2023, 10:12 PM
    hmmm, it seems that doing
    const formData = await context.request.formData();
    before any checking logic for 401 and 403 (or returning any response at all) solves this issue. Any idea why?
  • h

    hanpolo

    03/30/2023, 10:33 PM
    Hi. I'm new workers and am trying to understand how I control access to workers and durable objects. Right now it seems that once I've published a worker, anyone in the world can call it. How can I limit this so that my workers & durable objects can only be called from same origin or from pages functions. Are there any articles I can read on this?
  • u

    0xcaff

    03/30/2023, 11:04 PM
    What are these trace and test things in the type definitions for ExportedHandler?
  • j

    James

    03/30/2023, 11:07 PM
    Trace Workers: https://blog.cloudflare.com/workers-for-platforms/#trace-workers And Test Workers (mainly for internal workerd use right now): https://github.com/cloudflare/workerd/pull/341
  • k

    kian

    03/30/2023, 11:51 PM
    email is missing from that interface
  • k

    kian

    03/30/2023, 11:51 PM
  • u

    0xcaff

    03/31/2023, 1:37 AM
    Maybe its the version? I'm on 4.20230215.0 of @cloudflare/workers-types
  • f

    four33

    03/31/2023, 1:40 AM
    Has anyone hit the following error using `jest-environment-miniflare`:
    Copy code
    SyntaxError: Unexpected token ':'
    
          at VMScriptRunner.runAsModule (../node_modules/jest-environment-miniflare/node_modules/@miniflare/runner-vm/src/index.ts:34:20)
    I'm running
    jest
    with
    NODE_OPTIONS=--experimental-vm-modules
  • f

    four33

    03/31/2023, 1:41 AM
    It's a Typescript file
  • u

    0xcaff

    03/31/2023, 1:45 AM
    It looks like jest might not be transpilling your code. See the example here and ensure you have ts-jest or babel setup https://github.com/cloudflare/miniflare-typescript-esbuild-jest/blob/3c8ae62e04f3313a30aa85f6f96feb4c8233f1ac/jest.config.js#L2
1...237123722373...2509Latest