Nicolapps
Nicolapps2y ago

Access fetch’s Response.redirected in Convex runtime actions

This currently throws:
import { internalAction } from "./_generated/server";

export default internalAction(async ({ runMutation }) => {
const src = 'https://www.convex.dev/ai-town/';
const res = await fetch(src);
console.log(res.redirected);
});
import { internalAction } from "./_generated/server";

export default internalAction(async ({ runMutation }) => {
const src = 'https://www.convex.dev/ai-town/';
const res = await fetch(src);
console.log(res.redirected);
});
failure
Not implemented: get redirected for Response. Consider calling an action defined in Node.js instead (https://docs.convex.dev/functions/actions).
at <anonymous> (../convex/action_aitown.ts:6:1)
failure
Not implemented: get redirected for Response. Consider calling an action defined in Node.js instead (https://docs.convex.dev/functions/actions).
at <anonymous> (../convex/action_aitown.ts:6:1)
Even though I can use "use node" to make it work, it would be neat to make this work in the Convex runtime.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?