How to trim server's node_modules for deployment to lambda? #8682
Unanswered
rsslldnphy
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm trying to manually upload a Remix project, using Vite with a custom server to an AWS lambda function created by hand so I can get something working and understand the moving parts, before then automating with the CDK.
The Remix app itself is nicely bundled into the
build
directory. However theserver.js
file relies on dependencies in thenode_modules
folder, and this doesn't get bundled when runningremix vite:build
. And there's a whole load of stuff innode_modules
that won't be needed anyway. So that directory is far too big to upload to a lambda fn - above the max file size.What's the recommended way to deal with this? What should I be uploading to the lambda function to get it to work?
I'm sure this is a stupid question as it's been ages since I've had to deal with any infra. I'm trying to build a new, empty remix project for AWS lambda. I need to use a custom server as I'm going to need to provide a
getLoadContext
function for some auth stuff. So I have aserver.js
that imports@remix-run/express
(or should I be using@remix-run/architect
here?)I don't think I can use the
@architect
library for this as I use different AWS accounts for production and staging, which afaict it doesn't support, and even then all my attempts to get it to work with my MFAaws-vault
setup have failed.Thanks!
Beta Was this translation helpful? Give feedback.
All reactions