2

First of all, I am a Node newbie, moved from PHP development, so the question may be dumb..

I am in the process of developing a webservice using node with ESM ("import" syntax).

Now I am trying to build some microservices to do background operation using Lambdas with SQS as a trigger and Serverless framework as a deployment tool..

Now that I deployed the first Lambda, I realised ESM syntax isn't supported by Lambda but all services / factories are in ESM syntax already..

What's the best way to manage this lambda function based on services in ESM syntax?

And how do you deal with the common services used in both web service and lambda package? I don't want to duplicate to both projects in IDE if that makes sense.

Hence, I was hoping to place this serverless framework in the same folder and manage it from there, but unsure if this is the best way to move forward..

If I used 'Typescript', which I haven't had a chance to explore yet due to the deadline of the project, would I not have faced this issue with Lambda deployment?

1 Answer 1

3

With Serverless Webpack you can have both ESM and TypeScript support.

For common services, you can consider publishing them as packages, installing them directly from GitHub URLs or just place everything in the same repository and import them directly, whatever works best for you.

Sign up to request clarification or add additional context in comments.

1 Comment

Yup it works! I am still struggling yet Serverless Webpack did resolve this particular issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.