nitro icon indicating copy to clipboard operation
nitro copied to clipboard

Azure Functions adapter does not forward query string to localCall

Open xMorthi opened this issue 3 months ago • 0 comments

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

xMorthi avatar Sep 24 '25 13:09 xMorthi