@sinch/functions-runtime 0.3.5 → 0.3.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -248,7 +248,8 @@ function extractFunctionName(path6, body) {
248
248
  if (body?.event && isVoiceCallback(body.event)) {
249
249
  return body.event;
250
250
  }
251
- const segments = path6.split("/").filter((s) => s && s !== "*");
251
+ const pathname = path6.split("?")[0];
252
+ const segments = pathname.split("/").filter((s) => s && s !== "*");
252
253
  if (segments.length === 1 && isVoiceCallback(segments[0])) {
253
254
  return segments[0];
254
255
  }
@@ -451,7 +452,7 @@ function setupRequestHandler(app, options = {}) {
451
452
  res.type("image/svg+xml").send(svg);
452
453
  return;
453
454
  }
454
- if (req.method === "GET" && req.path === "/" && landingPageEnabled) {
455
+ if (req.method === "GET" && req.originalUrl === "/" && landingPageEnabled) {
455
456
  const acceptHeader = req.headers.accept || "";
456
457
  if (acceptHeader.includes("text/html")) {
457
458
  const html = getLandingPageHtml();
@@ -459,7 +460,7 @@ function setupRequestHandler(app, options = {}) {
459
460
  return;
460
461
  }
461
462
  }
462
- if (req.method === "GET" && req.path === "/" && !landingPageEnabled) {
463
+ if (req.method === "GET" && req.originalUrl === "/" && !landingPageEnabled) {
463
464
  const indexPath = nodePath.join(process.cwd(), "public", "index.html");
464
465
  if (nodeFs.existsSync(indexPath)) {
465
466
  res.type("html").sendFile(indexPath);
@@ -467,7 +468,7 @@ function setupRequestHandler(app, options = {}) {
467
468
  }
468
469
  }
469
470
  try {
470
- const functionName = extractFunctionName(req.baseUrl, req.body);
471
+ const functionName = extractFunctionName(req.originalUrl, req.body);
471
472
  logger(`[${(/* @__PURE__ */ new Date()).toISOString()}] ${req.method} ${req.path} -> ${functionName}`);
472
473
  onRequestStart({ functionName, req });
473
474
  const context = buildContext(req);
@@ -526,7 +527,7 @@ function setupRequestHandler(app, options = {}) {
526
527
  logger("Function execution error:", {
527
528
  error: error.message,
528
529
  stack: error.stack,
529
- function: extractFunctionName(req.path, req.body)
530
+ function: extractFunctionName(req.originalUrl, req.body)
530
531
  });
531
532
  res.status(500).json({
532
533
  error: "Internal server error",
@@ -534,7 +535,7 @@ function setupRequestHandler(app, options = {}) {
534
535
  ...process.env.NODE_ENV === "development" && { stack: error.stack }
535
536
  });
536
537
  onRequestEnd({
537
- functionName: extractFunctionName(req.path, req.body),
538
+ functionName: extractFunctionName(req.originalUrl, req.body),
538
539
  req,
539
540
  error,
540
541
  duration,