HTTP functions can only answer with NextResponse.json: headers are dropped, and redirects and Response fail

オープン
#603 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
56/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
活発
技術スタック
next.js, typescript
領域
api, backend

調査の方向性

Start with lib/services/ai-functions/route-module-runner.ts, especially the next/server shim around lines 286–301 and the return handling around lines 797–800. Trace how the handler result becomes an HTTP response, then check the existing tests for route-module HTTP functions. Done when the listed response forms preserve headers through to the caller, or deployment rejects unsupported forms with clear documentation.

索引モデルが issue の本文から書いたものです。

説明

A route-module function (trigger: "http") gets a next/server shim whose NextResponse has one method, json:

https://github.com/backenly/backenly/blob/364c901eee7a1aaf46e3a0a4e5f16217b1b20591/lib/services/ai-functions/route-module-runner.ts#L286-L301

and whatever the handler returns is reduced to { status, body }:

https://github.com/backenly/backenly/blob/364c901eee7a1aaf46e3a0a4e5f16217b1b20591/lib/services/ai-functions/route-module-runner.ts#L797-L800

So:

  • NextResponse.json(body, { headers }) loses its headers. No Set-Cookie, Cache-Control, Location or content type reaches the caller.
  • NextResponse.redirect(url) throws "NextResponse.redirect is not a function", and new NextResponse(...) throws "NextResponse is not a constructor".
  • Response is not defined in the function's scope, so new Response(csv, ...) and Response.json(...) throw.

The functions doc says a route module may import next/server and shows a NextResponse.json example, so agents write ordinary Next.js handlers: a CSV export with its content type, an OAuth callback that redirects, a login that sets a cookie. These deploy without complaint and then fail, or lose their headers, on every call.

Done when the common response forms work (NextResponse.json with headers, NextResponse.redirect, new Response, Response.json) with their headers passed through to the HTTP response, or the doc says exactly what is supported and deploy_code refuses the rest.

主要言語
TypeScript
スター
56
フォーク
19
平均マージ
14時間 4分
マージ済み PR(30日)
366

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

backenly/backenly のほかの issue

backenly/backenly の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。