AWS Lambda & particle-api-js Issues

I have a node.js solution that I’m deploying to AWS Lambda/Gateway API using Serverless.

For early testing I was using Axios and the API url: “https://api.particle.io/v1/products

This worked fine. But I wanted to use the “particle-api-js” library, which is working great on my local pc.

But once deployed to lambda, the app crashes at the “require:”

const Particle = require("particle-api-js");

“require is not a function”

Has anyone else come across this? My other option is to create a container for all my particle functions, but I really want to use Serverless/Lambda as there’s other functions I want along side of these. And I’d prefer not to use the URL Api method if I could avoid it.

Thanks.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.