Mar 02, 2021 10:26 AM
Hello everyone :wave:
AWS Lambda is a killer Airtable integration.
With a little code, you can build integrations that are endlessly customizable, incredibly reliable, and economical at scale.
So I wanted to share a tutorial that walks step-by-step through setting up a Lambda:
The tutorial uses our service, Sync Inc, as an example - but it’s really a jumping off point for any server-less integration.
With Airtable’s scripting block now supporting fetch, Airtable integrations with Lambda are easier than ever.
Of course, would love to hear any questions and feedback. How are you using Lambda with Airtable?
Mar 30, 2021 06:59 AM
Eric - interesting post… wondered if you had any insight into what I’m stuck on.
I’m trying to get an AWS lambda function to use airtable.js to call the Airtable API. I’m getting an error as the lambda loads up. I’ve created a lamdba layer containing the airtable.js package (npm install -s airtable) and that gets found OK but then I get this:
Error: Cannot find module '/var/task/node_modules/abort-controller/dist/abort-controller'. Please verify that the package.json has a valid \"main\" entry
I’ve also tried zipping the node package up with the function itself into a deployment package instead of using a layer, but with the exact same results. Tried both node 12.x and 14.x.
And I’ve tested locally -
npm install -s airtable and then
node test.js - and it works perfectly. (node 14.15.0)
What’s going on with airtable.js on aws lambda? Any ideas?
Mar 30, 2021 10:32 AM
Thanks for checking out out AWS lambda tutorial and posting this question.
It sounds to me like the your running into an issue when you are zipping up the folder. This stack overflow comment explains more - but be sure to compress the your folder in the terminal:
$ zip -r function.zip index.js node_modules package-lock.json package.json
Give this a try and let us all know if this works for you?
I’m curious - what is the ultimate functionality you are building in Lambda?
Mar 30, 2021 12:27 PM
Spot on. I don’t understand why, because what I was doing is exactly what I’m doing with about 25 other lambda functions and layers, which are all working perfectly. I can’t see anything different here…
My setup is that I’m provisioning all my AWS resources with Terraform, and my tf config zips up the layers and functions as part of the deployment. As I say, that works flawlessly elsewhere … but not here. Now I have to go and work out why - or change my toolchain to upload a zip separately before the terraform config picks it up.
To answer your curiosity - we have a public-facing form which is too complex for the standard Airtable form view to easily handle and don’t want to be dependent on other paid services. Lambda is the perfect low-cost route for what we need, with nearly all the subsequent data handling and processing sitting in Airtable.
Thanks very much for taking the trouble to reply, and coming up with the solution.