Hey all,I’m running into an issue with express and serverless functions. When I try to make an api call with my serverless function I get the following error
"Cannot find module 'express'
I was pretty sure that I had installed the dependencies correctly through my package.json and package-lock.json files, but I’m still quite new to using api’s/serverless functions
Thanks
Hey @DavidFJones,
Could you try installing the express module like this:
npm install express
and see if it works?
Hey @WendyGoh , so I’ve tried running that command both on my parent directory and the actually theme directory but I am still getting the same error when I attempt to run.
For reference my current local setup is a parent folder with the yml and node_modules folder, then I have a subdirectory that actually includes my theme and all associated files for it.
Hey @DavidFJones,
I believe my colleague Derek has been helping you out with this case on our developer slack channel and I’d like to update this case here for other users reference:
tl;dr
With serverless function, you do not need the `express` module. You only need to write the specific code you’d like to execute. HubSpot manages defining the endpoint, accepting requests and sending the response to the client for you.