fix(transport): accept ORGP self-signed cert via undici Agent
Some checks failed
Deploy / deploy (push) Failing after 1m20s

ORGP SPb uses a TLS chain Node rejects by default (curl works with -k
but Node fetch doesnt). Use an undici Agent with rejectUnauthorized
false for this one hop. Also drop the conflicting next.revalidate: 0
option — cache: no-store already covers it.
This commit is contained in:
Cosmo
2026-04-23 08:11:16 +00:00
parent 95352356b7
commit c25e15e697

View File

@@ -1,8 +1,12 @@
export const dynamic = 'force-dynamic'
import { NextResponse } from 'next/server'
import { Agent } from 'undici'
const ORGP_BASE = 'https://transport.orgp.spb.ru'
// ORGP TLS chain fails default verification in Node — match curl -k behaviour.
const insecureAgent = new Agent({ connect: { rejectUnauthorized: false } })
export async function GET(req: Request) {
const { searchParams } = new URL(req.url)
const stopId = searchParams.get('stopId')
@@ -31,8 +35,8 @@ export async function GET(req: Request) {
},
body: body.toString(),
cache: 'no-store',
// @ts-ignore next-internal option for timeout
next: { revalidate: 0 },
// @ts-ignore — undici dispatcher option at runtime
dispatcher: insecureAgent,
}
)