[email protected]'s Project
Describe the bug My Edge Function is consistently failing with a 500 Internal Server Error on every OPTIONS preflight request from the browser. This results in a CORS error on the client-side.
The issue persists even after deploying a minimal test function that only returns a 200 OK response with CORS headers. I have also tried deleting the function completely and redeploying it, but the 500 error remains. This suggests a platform or environmental issue.
To Reproduce
- Create a new Edge Function.
- Deploy the minimal code provided below.
- Try to call it from any browser-based client (e.g., using fetch in the browser console).
- The OPTIONS preflight request fails with a 500 status code.
Expected behavior The minimal test function should return a 200 status code for the OPTIONS request, not a 500 error.
Project information:
- Project ref: qlbwvpvtamlzlzvjovux
- Region: sa-east-1
Minimal code that reproduces the error:
import { serve } from "[https://deno.land/[email protected]/http/server.ts](https://deno.land/[email protected]/http/server.ts)"
const corsHeaders = {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Headers': 'authorization, x-client-info, apikey, content-type',
'Access-Control-Allow-Methods': 'POST, OPTIONS',
};
serve(async (req) => {
// Responds immediately to the CORS preflight request
if (req.method === 'OPTIONS') {
return new Response('ok', { status: 200, headers: corsHeaders });
}
return new Response('ok', { status: 200, headers: corsHeaders });
Please share the code you are using to call the edge function.
Hi all, We’re going to close this one due to inactivity. Please feel free to reopen if you’re still having issues here or open a new issue.