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

support combining vercel edge with serverless #1120

Open
1 task
kikyous opened this issue Apr 10, 2023 · 5 comments
Open
1 task

support combining vercel edge with serverless #1120

kikyous opened this issue Apr 10, 2023 · 5 comments
Labels
discussion enhancement New feature or request

Comments

@kikyous
Copy link

kikyous commented Apr 10, 2023

Describe the feature

Like something in next.js, user can specify runtime for a route using a named export config.
I know there is a vercel-edge preset, but it is project wide.

export const config = {
  runtime: 'edge',
}

export default (req) => new Response('Hello world!')

Additional information

  • Would you be willing to help implement this feature?
@ugurkellecioglu
Copy link

I'm facing a similar issue. I want only one of my functions to run on the edge, while the rest should be deployed as serverless. However, I couldn't find the configuration to achieve this :/

@pi0
Copy link
Member

pi0 commented Apr 18, 2023

Multi-target build to combine edge and lambda is planned: #1158

In the meantime, you can use a monorepo to build nitro app against vercel edge for that specific route and proxy from main app using route rules or directly update .vercel directory for custom handlers if really need the underlying API.

@pi0 pi0 added enhancement New feature or request and removed pending triage labels Apr 18, 2023
@pi0 pi0 changed the title vercel Edge API Routes support support combining vercel edge with serverless Apr 18, 2023
@pi0 pi0 added the discussion label Apr 18, 2023
@ugurkellecioglu
Copy link

Thanks for the quick reply, @pi0 :) I have played with the monorepo solution a little bit. I had a Nuxt app and a Nitro app in my monorepo. When I deployed it to Vercel, both Nitro and Nuxt exported their functions into the same path (.vercel/output/functions/__nitro.func/index.mjs). Since Nitro was built first, it was just overwritten by Nuxt serverless functions. Do you have any recommendations to overcome this?
Nitro app:
image

Nuxt App:
image

@pi0
Copy link
Member

pi0 commented Apr 18, 2023

Nice try @ugurkellecioglu! Is it possible to share your testing monorepo so i can try it?

@ugurkellecioglu
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants