fix(starter): add temp logging to debug executor inability to resolve envvars

This commit is contained in:
Waleed Latif
2025-02-19 13:49:29 -08:00
parent 47abb35a22
commit f6a639302e
2 changed files with 14 additions and 2 deletions

View File

@@ -249,7 +249,13 @@ export async function executeProviderRequest(
}
async function makeProxyRequest(providerId: string, payload: any, apiKey: string) {
const response = await fetch('/api/proxy', {
const baseUrl = process.env.NEXT_PUBLIC_APP_URL
if (!baseUrl) {
throw new Error('NEXT_PUBLIC_APP_URL environment variable is not set')
}
const proxyUrl = new URL('/api/proxy', baseUrl).toString()
const response = await fetch(proxyUrl, {
method: 'POST',
headers: {
'Content-Type': 'application/json',

View File

@@ -102,7 +102,13 @@ export async function executeTool(
}
// For external APIs, use the proxy
const response = await fetch('/api/proxy', {
const baseUrl = process.env.NEXT_PUBLIC_APP_URL
if (!baseUrl) {
throw new Error('NEXT_PUBLIC_APP_URL environment variable is not set')
}
const proxyUrl = new URL('/api/proxy', baseUrl).toString()
const response = await fetch(proxyUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ toolId, params }),