fix(prod): resolve middleware piping error and AI model ID
Some checks failed
Build & Deploy / 🧪 QA (push) Failing after 1m44s
Build & Deploy / 🔍 Prepare (push) Successful in 16s
Build & Deploy / 🏗️ Build (push) Has been skipped
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 3s
Some checks failed
Build & Deploy / 🧪 QA (push) Failing after 1m44s
Build & Deploy / 🔍 Prepare (push) Successful in 16s
Build & Deploy / 🏗️ Build (push) Has been skipped
Build & Deploy / 🚀 Deploy (push) Has been skipped
Build & Deploy / 🧪 Post-Deploy Verification (push) Has been skipped
Build & Deploy / 🔔 Notify (push) Successful in 3s
This commit is contained in:
@@ -51,12 +51,26 @@ export default async function middleware(request: NextRequest) {
|
|||||||
const hostHeader = headers.get('x-forwarded-host') || headers.get('host') || fallbackHost;
|
const hostHeader = headers.get('x-forwarded-host') || headers.get('host') || fallbackHost;
|
||||||
|
|
||||||
urlObj.protocol = proto;
|
urlObj.protocol = proto;
|
||||||
|
// Do NOT reconstruct NextRequest for GET/HEAD requests to avoid stream locking/piping errors.
|
||||||
effectiveRequest = new NextRequest(urlObj, {
|
// next-intl middleware primarily uses the URL and headers, so a simplified request-like object
|
||||||
headers: request.headers,
|
// or a redirected URL is often enough. For robustness, we only clone if we really have to.
|
||||||
method: request.method,
|
if (method === 'GET' || method === 'HEAD') {
|
||||||
body: request.body,
|
// In Next.js 15+, we can clone headers but avoid re-passing the body stream.
|
||||||
});
|
effectiveRequest = new NextRequest(urlObj, {
|
||||||
|
headers: new Headers(request.headers),
|
||||||
|
method: request.method,
|
||||||
|
// No body for GET/HEAD
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// For POST/PUT etc, we must be careful. Re-passing the body can only be done once.
|
||||||
|
// If we don't need to fix the URL for the body-reading part, we can skip it.
|
||||||
|
// But usually intl-middleware doesn't care about the body.
|
||||||
|
effectiveRequest = new NextRequest(urlObj, {
|
||||||
|
headers: new Headers(request.headers),
|
||||||
|
method: request.method,
|
||||||
|
body: request.body,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (process.env.NODE_ENV !== 'production' || !process.env.CI) {
|
if (process.env.NODE_ENV !== 'production' || !process.env.CI) {
|
||||||
console.log(
|
console.log(
|
||||||
|
|||||||
@@ -129,3 +129,16 @@ index 9081ae77d4eae53ce660e285c1a6babde99ceaab..f262f1dd0fd1199734024cc27905d956
|
|||||||
|
|
||||||
export const ChatWindowProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
|
export const ChatWindowProvider: React.FC<{ children: React.ReactNode }> = ({ children }) => {
|
||||||
return (
|
return (
|
||||||
|
|
||||||
|
diff --git a/dist/endpoints/chatEndpoint.js b/dist/endpoints/chatEndpoint.js
|
||||||
|
--- a/dist/endpoints/chatEndpoint.js
|
||||||
|
+++ b/dist/endpoints/chatEndpoint.js
|
||||||
|
@@ -50,7 +50,7 @@
|
||||||
|
try {
|
||||||
|
const result = streamText({
|
||||||
|
// @ts-ignore - AI SDK type mismatch
|
||||||
|
- model: openrouter('google/gemini-3.0-flash'),
|
||||||
|
+ model: openrouter('google/gemini-3.1-flash-lite-preview'),
|
||||||
|
messages,
|
||||||
|
tools: activeTools,
|
||||||
|
system: `You are a helpful Payload CMS MCP Assistant orchestrating the local Mintel ecosystem.
|
||||||
|
|||||||
Reference in New Issue
Block a user