mattmccabe
05/02/2023, 10:36 PMconst url_1 = require("url");
...
...
...
const url = new url_1.URL(input);//throws undefined
When I run wrangler dev I receive an undefined error I am guessing because the worker env doesn't know how to resolve the require("url") which is built into the nodejs runtime environment.
Is there a way to bundle some kind of replacement for nodejs's url lib/module in order to get the require("url") to resolve correctly inside of the worker runtime.
I was looking at the Configuration > Bundling documentation in the Wrangler docs but no lightbulbs have gone off on how to leverage it to provide a solution.
Any experience anyone can share would be greatly appreciated!torte
05/03/2023, 11:13 AMnode
command with a file in your project which has access to the whole context of the project (e.g. databases, env variables etc). A similar approach from other language/frameworks are Django management commands.
The way I imagine this is simply running wrangler dev
and instead of launching a worker service (which essentially runs as an HTTP service) it would execute a worker "script" which runs once and then exits. Is this possible in workers and if so how?Shami
05/03/2023, 1:15 PMbret_pat
05/03/2023, 3:16 PMpnpm create cloudflare workers worker-rust
and I'm trying to run pnpm wrangler dev
but I get an error
Running custom build: cargo install -q worker-build && worker-build --release
error[E0658]: use of unstable library feature 'bool_to_option'
I'll add my toml to a separate posttabletoe
05/04/2023, 9:36 AMJup
05/04/2023, 9:32 PMAriful
05/04/2023, 10:40 PMhappysalada
05/05/2023, 11:21 AMG4G4N
05/05/2023, 10:18 PMhannatawk
05/06/2023, 12:01 PMbever1337
05/07/2023, 1:04 AMWorkerGlobalScope
has a location
property that seems unavailable (at least on local workers.). Thanks for your help!redux1997
05/07/2023, 12:20 PMturikhay
05/07/2023, 10:11 PM/
) requests that contain query parameters (?anything
) are served by the origin instead of one of workers. I'm not sure why this happens. I would like all requests to /
to be served by CF.
I've set up the example to illustrate this:
$ curl https://test.0x0f.ru/
served from a worker
$ curl https://test.0x0f.ru/?a=b
served by the origin
icess
05/08/2023, 2:00 PMhttps://upstash_redis.url
, {
headers: {
Authorization: "Bearer Token"
}
})
const data = await response.json()
console.log(data)
if(data.result != null ){
return data.result
}
else {
return "https://www.example_deafult.com"
}
}nicksrandall
05/08/2023, 7:08 PMPrizewizE
05/09/2023, 9:38 AMmykola
05/09/2023, 9:51 AMhttps://cdn.discordapp.com/attachments/1105431886530084934/1105431886664314960/part2.JPG▾
https://cdn.discordapp.com/attachments/1105431886530084934/1105431886962102392/part1.JPG▾
Krull
05/09/2023, 3:00 PMSilabear
05/09/2023, 3:26 PMPUT
request with the valid headers and data, it returns 500, and the logs show Uncaught (in promise) TypeError: Incorrect type for Promise: the Promise did not resolve to 'Response'.
. I've been trying to fix this for a very long time, so any help would be appreciated!Gradyent
05/09/2023, 4:30 PMwrangler dev
or when deployed?
I am building a WebSocket client for Discord's Gateway API using DOs. Everything works when running locally with --local
, but when I remove --local
or when I deploy to CF, my WebSocket client (created via new WebSocket()
) immediately gets an error event that says Failed to establish the WebSocket connection: expected server to reply with HTTP status code 101 (switching protocols), but received 401 instead.
.
Discord's Gateway WS protocol doesn't require any authorization to open the WS connection normally (a token gets passed in a message later), and this exact same code works with wrangler dev --local
.
Could there be some difference in how new WebSocket()
when deployed to Cloudflare vs when running locally?ajgeiss0702
05/09/2023, 9:37 PMfaldor20
05/10/2023, 1:01 AMscfinan
05/10/2023, 3:28 AMthrow new Error('Multipart: Boundary not found');
^
Unhandled Promise Rejection: Error: Multipart: Boundary not found
Was missing this errorjasonkuhrt
05/10/2023, 4:02 PMBamboo
05/11/2023, 6:55 AMysmdev
05/11/2023, 7:01 AM@cloudflare/workers-types
pkg in Github?redux1997
05/11/2023, 11:24 AMKrull
05/11/2023, 1:21 PMmorris
05/11/2023, 2:24 PMworkers-chat-demo
account_id, and run wrangler login
. Running wrangler publish
gives me an error:
> In order to use Durable Objects, you must agree to pricing at
> https://dash.cloudflare.com/aac1a529c1da5d1cbd4c1c1cb12f9675/workers/overview?enable-durable-objects
This link sends me to the workers overview page, with no CTA to enable durable objects.
Going to the docs, https://developers.cloudflare.com/workers/runtime-apis/durable-objects/#durable-objects
> ... Navigate to “Workers” and opt in to pricing.
I expected that I should be able to set up my pay-as-you-go plan and re-login via wrangler but it's not working. What can I try next?jasonkuhrt
05/11/2023, 3:44 PMenv.BINDING.fetch(...)
call it leads to a 403 response. That response is NOT coming from our code. Why is CF doing this?
The body response is:
error code: 1003