Peps
01/30/2021, 8:03 PMCeru ©
01/30/2021, 9:58 PMCeru ©
01/30/2021, 9:58 PMPeps
01/30/2021, 10:19 PMPeps
01/30/2021, 10:20 PMPeps
01/30/2021, 10:21 PMCeru ©
01/30/2021, 10:25 PMkenton
01/31/2021, 8:40 PMdalek_cos
01/31/2021, 9:43 PMkenton
02/01/2021, 1:21 AMjed
02/02/2021, 1:08 PMworkers.api.error.unknown (Code: 10013)
error on the /workers/edit/{name}
page.kenton
02/02/2021, 3:52 PMtp
02/05/2021, 10:16 AMtp
02/05/2021, 10:39 AMtoinbis
02/05/2021, 8:25 PMtp
02/05/2021, 10:47 PMtp
02/05/2021, 11:27 PMkenton
02/06/2021, 12:15 AMkenton
02/06/2021, 12:19 AMtp
02/06/2021, 12:21 AMtp
02/06/2021, 12:21 AMtp
02/06/2021, 5:28 AMtp
02/06/2021, 5:29 AMtp
02/06/2021, 6:15 AMtp
02/06/2021, 6:31 AMnpm install wscat -g
) use wscat -c <url from step 1>
to view messages come in, type listen
and press enter to enable the debug hook where errors should come in if there are any - but none come inGreg Brimble | Cloudflare Pages
02/06/2021, 8:03 PMpublish.sh
script or the documentation that I could send more than one MJS file in my upload, nor that the name of those files don't matter. Below is totally valid, but that wasn't obvious to me:
sh
# upload_script uploads our Worker code with the appropriate metadata.
upload_script() {
curl_api https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/workers/scripts/$SCRIPT_NAME \
-X PUT \
-F "metadata=@metadata.json;type=application/json" \
-F "script=@index.mjs;type=application/javascript+module" \
-F "datatable=@datatable.mjs;type=application/javascript+module" \ # More than one MJS file (name it anything)
-F "icanputanythinghere=@index.html;type=application/octet-stream" > /dev/null
}
2. There's no way to delete a DO. If I have the ID of an existing DO, I might want to delete the DO and all of its storage. Right now, the best I can do is get the DO, and just iterate over the storage, deleting everything. The DO itself seemingly can't be deleted.Greg Brimble | Cloudflare Pages
02/06/2021, 8:03 PMJSON.stringify(data)
and await response.json()
is a bit of a faff. I realize that it has to go through the Fetch API, but an async json() {}
method (or similar) on the DO stub would remove an annoying bit of boilerplate I have to include in all my DOs. I realize you lose the routing side of things by doing this instead of using fetch
, but I'd argue that something like Redux's patterns here are actually better:
js
await usersStub.json({
type: "updateUser",
data: {
firstName: "Greg"
}
})
versus
js
await usersStub.fetch('http://fakehost/user', {
method: "POST",
body: JSON.stringify({ firstName: "Greg" })
})
Better, not just because of the reduced overhead with fetch
, but also because I would be able to (more easily) type the action with TypeScript. I could easily mandate that the updateUser
type action has a body that has a firstName
attribute. That's harder in with fetch
if I'm splitting up my data between the request URL and the body.
4. Love the MJS support. It is beautiful <3. We just need support (from Cloudflare and from tooling such as bundlers) to catch up.
cc @Userkenton
02/07/2021, 1:38 AMstorage.deleteAll()
method to help with this -- and document it better.Greg Brimble | Cloudflare Pages
02/07/2021, 1:40 AMkenton
02/07/2021, 1:40 AM