Calling AirTable API from inside a Lambda function

Topic Labels: ImportingExporting
1061 1
Showing results for 
Search instead for 
Did you mean: 
4 - Data Explorer
4 - Data Explorer


I am trying to call AirTable from inside a Lambda function using a local instance (using AWS SAM).
If I just use node/js as is, it all works fine (so I know the code should work). But once I put it inside the Lambda and try to run it, I see nothing in the console.
Any clues as to what is going on?
This is the code I am running

let response;
exports.lambdaHandler = async (event, context) => {
    var Airtable = require('airtable');
    var base = new Airtable({apiKey: 'k***************3'}).base('ap****************8jC');

    base('Course Locations').select({
        maxRecords: 3,
        view: "Myview"
    }).eachPage(function page(records, fetchNextPage) {
        records.forEach(function(record) {
            console.log('Retrieved');//, record.get('Name (Abbrev.)')

    }, function done(err) {
        if (err) {

    try {
        response = {
            'statusCode': 200,
            'body': JSON.stringify({
                message: 'hello world',
    } catch (err) {
        return err;
    return response

I do see the “hello world” in the log/response.
The code as is runs well when I use it in a simple javascript file and run it with node.
In simple node, I do see the console.log('Retrieved'); but not inside a lmbda

1 Reply 1
4 - Data Explorer
4 - Data Explorer

I ran into a very similar problem and the code in this tutorial fixed it for me: Airtable API Tutorial with cURL and JavaScript ―

Originally, I was using the code from the airtable API and it only worked locally. This works locally and in my aws console.