@@ -6,7 +6,7 @@ export async function GET(request: NextRequest) {
66 const searchParams = request . nextUrl . searchParams ;
77 const token = searchParams . get ( "token" ) ;
88 const pipeName = searchParams . get ( "pipe" ) ;
9-
9+
1010 if ( ! token || ! pipeName ) {
1111 return NextResponse . json (
1212 { error : "Missing required parameters" } ,
@@ -15,7 +15,7 @@ export async function GET(request: NextRequest) {
1515 }
1616
1717 const url = new URL ( `${ TINYBIRD_API_URL } /${ pipeName } .json` ) ;
18-
18+
1919 // Forward all query parameters except token and pipe
2020 searchParams . forEach ( ( value , key ) => {
2121 if ( key !== "token" && key !== "pipe" ) {
@@ -34,7 +34,7 @@ export async function GET(request: NextRequest) {
3434 return NextResponse . json ( data ) ;
3535 } catch ( error ) {
3636 return NextResponse . json (
37- { error : "Failed to fetch data from Tinybird" } ,
37+ { error : "Failed to fetch data from Tinybird: " + error } ,
3838 { status : 500 }
3939 ) ;
4040 }
@@ -51,7 +51,7 @@ export async function POST(request: NextRequest) {
5151 }
5252
5353 const url = new URL ( `${ TINYBIRD_API_URL } /${ pipe } .json` ) ;
54-
54+
5555 // Add all params as query parameters
5656 Object . entries ( params ) . forEach ( ( [ key , value ] ) => {
5757 url . searchParams . append ( key , String ( value ) ) ;
@@ -68,7 +68,7 @@ export async function POST(request: NextRequest) {
6868 return NextResponse . json ( data ) ;
6969 } catch ( error ) {
7070 return NextResponse . json (
71- { error : "Failed to fetch data from Tinybird" } ,
71+ { error : "Failed to fetch data from Tinybird: " + error } ,
7272 { status : 500 }
7373 ) ;
7474 }
0 commit comments