Skip to content

Commit bae94e9

Browse files
María Paz Arrieta LandazuriMaría Paz Arrieta Landazuri
authored andcommitted
fix: agregar logs para debug de API key de Airtable
1 parent a900edb commit bae94e9

File tree

2 files changed

+24
-3
lines changed

2 files changed

+24
-3
lines changed

frontend/src/app/evaluacion-previsional/resultados/page.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,9 +160,23 @@ function ResultadosContent() {
160160

161161
setShowSuccessMessage(true);
162162
setSubscriptionData({ nombre: '', email: '' });
163-
} catch (error) {
163+
} catch (error: any) {
164164
console.error('Error al guardar suscripción:', error);
165-
setError('Hubo un error al procesar tu suscripción. Por favor, intenta nuevamente.');
165+
let errorMsg = 'Hubo un error al procesar tu suscripción. Por favor, intenta nuevamente.';
166+
if (error && error.message) {
167+
errorMsg += `\nDetalles: ${error.message}`;
168+
}
169+
if (error && error.statusCode) {
170+
errorMsg += `\nStatusCode: ${error.statusCode}`;
171+
}
172+
if (error && error.response) {
173+
errorMsg += `\nResponse: ${JSON.stringify(error.response)}`;
174+
}
175+
if (error && error.data) {
176+
errorMsg += `\nData: ${JSON.stringify(error.data)}`;
177+
}
178+
errorMsg += `\nError completo: ${JSON.stringify(error)}`;
179+
setError(errorMsg);
166180
}
167181
};
168182

frontend/src/lib/airtable.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import Airtable from 'airtable';
22

3+
// Log para verificar la API key (sin mostrar la key completa por seguridad)
4+
const apiKey = process.env.NEXT_PUBLIC_AIRTABLE_API_KEY;
5+
console.log('API Key presente:', !!apiKey);
6+
console.log('API Key longitud:', apiKey?.length);
7+
console.log('Base ID:', process.env.NEXT_PUBLIC_AIRTABLE_BASE_ID);
8+
39
if (!process.env.NEXT_PUBLIC_AIRTABLE_API_KEY) {
410
throw new Error('NEXT_PUBLIC_AIRTABLE_API_KEY is not defined in environment variables');
511
}
@@ -25,7 +31,8 @@ export async function createEvaluation(data: EvaluationData) {
2531
try {
2632
console.log('Intentando guardar en Airtable:', {
2733
table: TABLE_NAME,
28-
data: data
34+
data: data,
35+
apiKeyPresent: !!process.env.NEXT_PUBLIC_AIRTABLE_API_KEY
2936
});
3037

3138
const fields: Record<string, any> = {

0 commit comments

Comments
 (0)