Would love to hear about this, have been hacking i...
# getting-started
c
Would love to hear about this, have been hacking it for the last week. Feels like swimming upstream.
b
how can we help?
c
Thank you so much. In my case, I’m migrating my current implementation and have been pretty eager to use pulumi. From different repositories into a monorepo (turbo n pnpm) and have been quite easy to set up. My biggest hurdle has been in deploying the code for lambdas and tasks in typescript. My folder structure currently is: turbo.json package.json pnpm-lock.yaml pnpm-workspace.yaml apps - infrastructure - fns - authors - comic-books - web packages - core The
packages/core
contains the entirety of the business logic. The
apps/fns
is the middle place where the core package is imported and exposed to the lambda handler and the
apps/infrastructure
holds the pulumi code which deploys the lambda with the code in fns app. The following are the solutions I’ve tried: • Created a callback function that imports the fns app directly into infrastructure and calls its exports inside of the callback. The result is that the dependencies from core are logged as not found. • Archives do not work because it requires the code be in javascript first. • Tried creating a docker image in which I bundle the code in esbuild but because the dockerfile is located in fns, it doesn’t include the code from packages/core nor the pnpm-lock file that is at the root. • Also tried bundling it outside of the docker image, in the pulumi file but for some packages the architecture mismatches from the lambda one. What I’m trying to achieve is the separation of infrastructure, backend code as (micro tasks) and web and trying to reuse as much as code as possible (core) between backend and frontend.
b
It’s not super clear what the issue is, but my assumption here is that you’re struggling with depedencies?
c
Yeap, these attempts I’ve tried so far haven’t gotten me so far a solution in which dependencies (lock file, local modules, node_modules) are bundled appropriately and my code built for the lambda function.
b
I’d recommend keeping the application and infrastructure dependencies completely separate.
c
Could you suggest an approach to build the lambda function in the pulumi file in which I can include these dependencies present in the fns package? I currently have the dependencies of infrastructure and application in different packages. It’s this division that I don’t know how to approach to consolidate them in the lambda function.