Skip to content

Deploying to Vercel Edge function #192

Open
@babyradJiri

Description

@babyradJiri

When deploying Nuxt 3 project to Vercel Edge function, I get an error "Could not resolve a fetch() method, you should provide one". I managed to fix this by setting up Villus like this:

import { createClient } from "villus";
import { fetch as fetchPlugin } from "villus";

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.use(
    createClient({
      url: `${nuxtApp.$config.public.backendUrl}/graphql`,
      use: [fetchPlugin({ fetch })],
    }),
  );
});

By passing fetch to renamed fetch plugin, all works. I think this shouldn't be required and is probably issue with resolveGlobalFetch function not finding Vercel fetch. I haven't figured out how to modify it tho.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions