nitrojs / nitrojs/nitro

Azure Functions adapter does not forward query string to localCall

Open
#3,588 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug nuxt v2
Dominant language
TypeScript
Stars
11.2k
Forks
899
Avg merge
2d 24m
Merged PRs (30d)
40

Description

Environment
  • Nitro version: v2
  • Nuxt version: 4.1.1
  • Target: azure_functions (via NITRO_PRESET=azure_functions nuxi build)
  • Hosting: Azure Functions (Linux consumption plan)
Reproduction

Building with NITRO_PRESET=azure_functions and deploying to Azure Functions.
Any Nuxt server route (defineEventHandler) that calls getQuery(event) will always return {} when using query parameters in the request.

Example request:

GET /api/v1/org/123/site/456/events?scenario_id_applied=abc&event_type=all

Server code:

defineEventHandler((event) => {
  return getQuery(event);
});

Response is {} instead of the expected object.

Describe the bug

The generated Azure Functions entry (.output/server/chunks/nitro/nitro.mjs) builds the request URL like this:

const url = "/" + (req.params.url || "");

This only forwards the path from {*url} and discards the query string.
However, req.url and req.originalUrl in Azure already contain the proper query parameters.

Because the query is never appended to the localCall(), Nitro cannot parse it and getQuery(event) always returns empty.

Additional context
  • This is an adapter bug specific to the azure_functions preset.
  • Queries are visible in both req.url and req.originalUrl; only the preset drops them.
  • A fix is trivial append of the query portion
Logs
Excerpt from `context.log` in Azure Functions:


req.params.url api/v1/org/.../events
req.url https://.../events?scenario_id_applied=6ab9...&event_type=all
req.originalUrl https://.../events?scenario_id_applied=6ab9...&event_type=all

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the generated Azure Functions entry at .output/server/chunks/nitro/nitro.mjs and trace how the azure_functions preset constructs the localCall URL. Compare req.params.url with req.url and req.originalUrl during the provided reproduction. Done means query parameters reach localCall and getQuery(event) returns them for the example request.

Written by the indexing model from the issue text.

Assessment

Tech stack
azure, typescript
Domain
backend, cloud
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.