cyzyvos
cyzyvos
Explore posts from servers
CDCloudflare Developers
Created by cyzyvos on 8/30/2023 in #workers-help
Is it possible to upload a worker script (w/ ESM syntax) using the API?
thanks @baya_78759 and @kiannh, this worked!
7 replies
CDCloudflare Developers
Created by cyzyvos on 8/30/2023 in #pages-help
Is it possible to upload files via the API?
thanks @cyb3rjak3! that's what I was afraid of. Unfortunately, I'm trying to get this to work in Deno so wrangler is not an option. just for reference – this is where the magic happens in wrangler, I think: https://github.com/cloudflare/workers-sdk/blob/main/packages/wrangler/src/pages/upload.tsx
3 replies
CDCloudflare Developers
Created by cyzyvos on 8/30/2023 in #workers-help
Is it possible to upload a worker script (w/ ESM syntax) using the API?
Unfortunately, I don't think that's the case. If I try to deploy my script via the API, I get the following error response:
{
result: null,
success: false,
errors: [
{
code: 10021,
message: "Uncaught SyntaxError: Unexpected token 'export'\n at worker.js:432\n"
}
],
messages: []
}
{
result: null,
success: false,
errors: [
{
code: 10021,
message: "Uncaught SyntaxError: Unexpected token 'export'\n at worker.js:432\n"
}
],
messages: []
}
If I paste the exact same code into the dashboard editor, it works. Also, the API doc explicitly states that only the service worker syntax is supported: https://developers.cloudflare.com/api/operations/worker-script-upload-worker-module#request-body
7 replies