Jason Hostetter
Jason Hostetter
Explore posts from servers
NNuxt
Created by Jason Hostetter on 7/14/2024 in #❓・help
Serving static assets from a dynamic path
I have a situation where I am serving an application at a particular path, say /path/to/document/doc-id-1234. The application handling that document is an external library that loads some codecs using web workers. These workers also load additional assets. It appears that the workers are hard-coded to load assets from the current file path, i.e. /path/to/document/asset-1.wasm. It works to put those assets in public/path/to/document. But, if I have alternate paths, I would have to copy those assets to every possible path in the public directory so it is available. Is there a way to write a hook that can see if one of these assets are being requested (matching the filename in the request url for instance), and then returning the asset regardless of the request path?
1 replies
CDCloudflare Developers
Created by Jason Hostetter on 3/22/2024 in #workers-help
Content-Encoding not set
Hoping someone can help me with a weird problem: I am sending a gzipped object from R2 through a Worker in a Response. I set Content-Encoding: gzip in the response's headers. When I send the request from HTTPie (desktop REST client), I see the appropriate Content-Encoding header in the response. But when the request comes from the browser (Chrome), no Content-Encoding header is set in the response at all, and Chrome does not decompress the response body as it should. Why would the Content-Encoding header not be set or ignored in Chrome? Is this a CORS issue?
4 replies
CDCloudflare Developers
Created by Jason Hostetter on 9/9/2023 in #workers-help
Measuring worker execution time
I have a worker which receives a posted file, does some processing with wasm, and saves it to R2. With a large file, the request can take more than 1 minute to complete, although . It’s an unbound worker, but the docs say the CPU limit is 30s. The request completes without an error. The dashboard doesn’t report CPU usage more than about 4-5s. Is wasm execution time not counted towards CPU time?
2 replies
CDCloudflare Developers
Created by Jason Hostetter on 4/4/2023 in #workers-help
Error: Promise will never complete
I have a worker that does some processing of image frames that are posted to the url and stores them in R2. This works fine with single image frames. When I post more than 50 frames, The worker dies after the 50th iteration through the processing loop and throws the error: "Error: Promise will never complete" This worker is on the free bundled usage model, so I know subrequests are limited to 50, but I don't think I'm making any subrequests except to R2, which per the docs seems like it should allow 1000 requests even on the bundled usage model?
23 replies
CDCloudflare Developers
Created by Jason Hostetter on 1/25/2023 in #workers-help
Instantiating wasm built with emscripten
I am trying to convert some code to a worker that uses 4 different webassembly modules (compiled from C/C++ libraries using emscripten) depending on the data that is posted. We had been using the .js file generated by emscripten to load and instantiate the module, but his fails on the Worker when it tries to do a require() to detect the environment. I am unclear how to correctly instantiate the module in a Worker, trying to import the .wasm files and using WebAssembly.instantiate() complains about not having the correct imports object. Is there a clear guide for how to do this correctly?
10 replies