Missing headers in Functions v2.0


I have vite/Vue3 app and I don’t seem to be able to access headers when I use the new style .mjs functions in development or production. Is this intentional? Is there a way to configure access?

This behavior is visible in the app here: https://netlify-header-test.netlify.app/

Relevant code is here: https://github.com/tdbit/netlify-header-test/blob/master/src/components/HelloWorld.vue

The custom header ‘my-header: test’ is definitely sent as evidenced both by looking at chrome’s network tab and by the fact that it is picked up by the old function style.


v2 functions use Request objects, which are unlike the payloads received by v1 functions. The request object has a headers field, but it is not a plain object like you may expect. If you are trying to use headers['my-header'], replace it with headers.get('my-header').