New Netlify function format

Hi folks,

I’m not sure if this is a Redwood thing or not, but Netlify have a V2 for their functions released in October which I wanted to explore to support streaming OpenAI responses. (The existing function format can also support ReadableStream in the response body - Lambda compatibility for Functions | Netlify Docs)

The Netlify announcement is here - Netlify introduces new Functions capabilities

When I attempt to use the new format I get api warnings in the console stating /function_name does not have a function called handler defined.

I also get empty responses using return new Response();

Does Redwood require the V1 handler format for Netlify functions to work?

Hi @hamishirving

The Core Team did learn of this new function support from Netlify, but we haven’t had a chance to test it out – there may be an issue in the the way Redwood bundles up and deployed the function.

What would really help us is if you shared a small reproducible case (a GH link to a rep, for example) with a function you want to try out that shows the error, then we can clone it and try to diagnose the cause.

Also, curious, if you use the Netlify CLI tools like Netlify Live Get started with Netlify CLI | Netlify Docs do you see the same issue?

Thanks!

@hamishirving I mention this to the Core Team and was reminded that currently redwood functions have to be able to be deployed to Netlify or Vercel or render or Fly … and as such we haven’t added ways to ue functions for Netlify edge functions or builder functions or background functions.

But I have used them (edge functions) by implementing them manually and setting u the toml and such.

Perhaps there is a way to compose and deploy them manually for v2 support?

Hi DT,

Thanks for looking into this. I created a simple reproduction testing the two different formats of functions with a fresh install of Redwood.

Repo: GitHub - hamishirving/netlify-functions-test
Deployed: https://main--netlify-functions-text.netlify.app/

I understand it’s down to severless runtime support and whether native web APIs such as Request and Response are supported?

Appreciate this @hamishirving I’mm try to reproduce – or if anyone else in the community could help me out for time’s sake – and see what we find out. It would be nice to use some of those v2 features.

Quick update, I ended up using Edge Functions built into Supabase as they support streaming in their deno runtime.

Would be great if this could be supported in Redwood’s functions though