diff --git a/server/src/routes/auth.ts b/server/src/routes/auth.ts index 6b186511..94598a44 100644 --- a/server/src/routes/auth.ts +++ b/server/src/routes/auth.ts @@ -611,7 +611,7 @@ router.get("/airtable", (req, res) => { response_type: 'code', state: robotId.toString(), - scope: 'data.records:read data.records:write schema.bases:read', + scope: 'data.records:read data.records:write schema.bases:read schema.bases:write', code_challenge: code_challenge, code_challenge_method: 'S256' }); @@ -804,6 +804,8 @@ router.post("/airtable/remove", requireSignIn, async (req: AuthenticatedRequest, airtable_access_token: null, airtable_refresh_token: null, airtable_base_id: null, + airtable_table_name: null, + airtable_table_id: null, }); diff --git a/server/src/workflow-management/integrations/airtable.ts b/server/src/workflow-management/integrations/airtable.ts index fdcd1a3b..7ef2f2fb 100644 --- a/server/src/workflow-management/integrations/airtable.ts +++ b/server/src/workflow-management/integrations/airtable.ts @@ -38,13 +38,13 @@ export async function updateAirtable(robotId: string, runId: string) { if (!robot) throw new Error(`Robot not found for robotId: ${robotId}`); const plainRobot = robot.toJSON(); - if (plainRobot.airtable_base_id && plainRobot.airtable_table_name) { + if (plainRobot.airtable_base_id && plainRobot.airtable_table_name && plainRobot.airtable_table_id) { console.log(`Writing to Airtable base ${plainRobot.airtable_base_id}`); await writeDataToAirtable( robotId, plainRobot.airtable_base_id, plainRobot.airtable_table_name, - plainRobot.airtable_table_id || '', + plainRobot.airtable_table_id , data ); console.log(`Data written to Airtable for ${robotId}`); @@ -82,6 +82,8 @@ export async function writeDataToAirtable( if (sampleRow) { const sampleValue = sampleRow[field]; await createAirtableField(baseId, tableName, field, sampleValue, accessToken, tableId); + console.log("from airtable.ts",tableId); + console.log("from airtable.ts",tableName); } }