Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploying to Vercel Edge function #192

Open
babyradJiri opened this issue Mar 21, 2023 · 0 comments
Open

Deploying to Vercel Edge function #192

babyradJiri opened this issue Mar 21, 2023 · 0 comments

Comments

@babyradJiri
Copy link

babyradJiri commented Mar 21, 2023

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.

@babyradJiri babyradJiri changed the title Deploying to Vercel Edge f Deploying to Vercel Edge function Mar 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant