endymion1818
endymion1818
CDCloudflare Developers
Created by endymion1818 on 1/15/2024 in #workers-help
your worker created multiple branches
I've got this error every single time in Wrangler, sometimes it results in crashes, sometimes not, but I cannot fathom why. This is the entirety of my function so far
export function onRequest(context) {
if(context.request.method !== 'POST') {
return new Response('Not allowed', { status: 405 }
}
try {
return new Response('OK', { status: 200 });
} catch(e) {
throw new Error('Error')
}
}
export function onRequest(context) {
if(context.request.method !== 'POST') {
return new Response('Not allowed', { status: 405 }
}
try {
return new Response('OK', { status: 200 });
} catch(e) {
throw new Error('Error')
}
}
Please help me to understand why I'm getting this error. I'm not cloning anything. What does cloning even mean? This is on Wrangler 3.22.3
2 replies
CDCloudflare Developers
Created by endymion1818 on 1/12/2024 in #workers-help
wrangler pages dev ... what is the functions address??
Again a silly question but it's not in the documentation that I could find. When you're running a local dev server with wrangler, it tells me it's recognised the function, and has copied it to some temp folder, but am I able to access it via the web browser locally? I'm trying to debug things and this would significantly close the feedback loop.
2 replies
CDCloudflare Developers
Created by endymion1818 on 1/11/2024 in #workers-help
POSTing to a function results in no response
I'm using a form action to post to my function
<form method="POST" action="/functions/send-email"
<form method="POST" action="/functions/send-email"
However Wrangler keeps erroring with "No response" My function is:
export async function onRequest() {
return Response.redirect('/')
}
export async function onRequest() {
return Response.redirect('/')
}
Please tell me what I'm doing wrong
4 replies
CDCloudflare Developers
Created by endymion1818 on 1/11/2024 in #workers-help
Are the examples on docs out of date?
I'm talking about the ones one developers.cloudflare.com/workers/examples. Using export default causes the error
Error: No routes found when building Functions directory
Error: No routes found when building Functions directory
3 replies
CDCloudflare Developers
Created by endymion1818 on 1/11/2024 in #workers-help
Where are functions located?
Feels a bit silly asking this but I keep calling or visiting my function url on my deployed site (like example.com/functions/my-function), but I get a 404 response from my frontend application. What is the correct path for functions once the site has been deployed? Could anything else be happening here?
6 replies
CDCloudflare Developers
Created by endymion1818 on 1/11/2024 in #workers-help
secrets: `.env.SECRET_NAME` or `context.env.SECRET_NAME`
I have a .dev.varslocally with some secrets, and Wrangler is telling me they're available, however in my worker I've tried both ${env.SECRET_NAME} and {context.env.SECRET_NAME}, neither of which is resolving. Does anyone know what might be the issue? Since the documentation mentions both approaches, I am suspicious that either might be incorrect.
3 replies