Returning Web Response in Azure SWA is not working
Open
Nobody has claimed this yet.
bug
nuxt
preset:azure
preset:azure-functions
v2
- Dominant language
- TypeScript
- Stars
- 11.2k
- Forks
- 899
- Avg merge
- 2d 24m
- Merged PRs (30d)
- 40
Description
Environment
Nuxt: 3.12.3
Node: 20
Reproduction
Deploy a basic Nuxt app with an api that returns a web response like
export default function eventHandler((event) => {
return new Response(JSON.stringify({ username: 'test' }), { headers: { 'Content-Type': 'application/json' } })
})
Describe the bug
Instead of the actual json, Im getting an empty object returned when deployed to Azure SWA:
// /api/user
{}
Additional context
No response
Logs
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the basic Nuxt API shown in the issue, deploy it to Azure SWA, and compare the returned response with the local result. Trace how the Web Response is serialized in the Azure SWA deployment path; done means /api/user returns the JSON object containing username: "test" instead of {}.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, nuxtjs, typescript
- Domain
- api, backend, cloud
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100