Skip to content

Clone of request object fails in v 4.11 #406

@antonandreyev

Description

@antonandreyev

If you use clone method on request object in HTTP triggered function with POST method, an exception is thrown.

Happens in version 4.11.0, if you roll back to 4.10.0 the issue is gone.

Stack trace:

Result: Failure Type: Exception: Cannot clone object of unsupported type. Stack: DataCloneError: Cannot clone object of unsupported type. at new DOMException (node:internal/per_context/domexception:76:18) at structuredClone (node:internal/worker/js_transferable:126:26) at HttpRequest.clone (/home/site/wwwroot/node_modules/@azure/functions/dist/azure-functions.js:1878:25) at /home/site/wwwroot/dist/src/functions/HandleSlackAchievementCommand.js:26:82 at Generator.next (<anonymous>) at /home/site/wwwroot/dist/src/functions/HandleSlackAchievementCommand.js:8:71 at new Promise (<anonymous>) at __awaiter (/home/site/wwwroot/dist/src/functions/HandleSlackAchievementCommand.js:4:12) at handleSlackAchievementCommand (/home/site/wwwroot/dist/src/functions/HandleSlackAchievementCommand.js:24:12) at InvocationModel.<anonymous> (/home/site/wwwroot/node_modules/@azure/functions/dist/azure-functions.js:215:46)

Environment

  • Node 24
  • Cloud deployment, Linux
  • Flex Plan
  • @azure/functions = 4.11.0

Additional context

Handling Slack events webhook

Minimal repro

import { app, } from "@azure/functions";

async function handleEvent(
  request: HttpRequest,
  context: InvocationContext
): Promise<HttpResponseInit> {

  const clonedRequest = request.clone();
}

app.http("HandleAppHomeOpened", {
  methods: ["POST"],
  authLevel: "function",
  handler: handleEvent,
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions