Airtable Scripting not parsing Stripe API response

I’m trying to use an Airtable Automation script to lookup a customer ID in the Stripe API. My fetch call is returning a 200 but the data object is empty in the Airtable script even though the same call has a valid JSON response via curl in terminal.
Screen Shot 2022-09-13 at 9.49.40 AM

Here’s the full script code:

let Stripe_API = 'YOUR_STRIPE_API_KEY';
let Stripe_URL = 'https://api.stripe.com/v1/customers/cus_MQGV6PEdpS1RWJ';
    
let options = {
    method: 'GET',
    headers: {
        'Authorization': 'Bearer ' + Stripe_API 
    }
};
console.log(options);

let response = await fetch(Stripe_URL, options);
console.log(response);

Does anyone have ideas about why Airtable isn’t recognizing the full response from the Stripe API?

FYI, found the fix (use response.json() ) in another thread: Having trouble with Fetch in scripting block - #3 by kuovonne

Here’s a version that works:

let Stripe_API = 'YOUR_STRIPE_API_KEY';
let Stripe_URL = 'https://api.stripe.com/v1/customers/cus_MQGV6PEdpS1RWJ';
    
let options = {
    method: 'GET',
    headers: {
        'Authorization': 'Bearer ' + Stripe_API 
    }
};
console.log(options);

let response = await fetch(Stripe_URL, options);
let responseJson = response.json();
console.log(responseJson);
5 Likes