im tring to use an http action but when i try to use it on my front end i get a cors error:
import { httpRouter } from 'convex/server';
import { httpAction } from './_generated/server';
import { internal } from './_generated/api';
import { authKit } from './auth';
const http = httpRouter();
authKit.registerRoutes(http);
http.route({
path: '/test',
method: 'POST',
handler: httpAction(async () => {
console.log('hi');
return new Response(JSON.stringify({ error: '403' }), {
status: 200,
headers: { 'Content-Type': 'application/json', 'Access-Control-Allow-Origin': '*' }
});
})
});
from origin 'http://localhost:5173' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
const response = await fetch(PUBLIC_CONVEX_SITE_URL + '/test', {
method: 'POST',
body: formData,
headers: {
Authorization: Bearer ${data.accessToken}
}
});