Hopefully the last stupid question of the day: If ...
# help
b
Hopefully the last stupid question of the day: If I wanted all source to be included when a lambda builds (no tree shaking) how do I set this up? I assume i need to do something with the bundle.esbuild config right? @thdxr I imagine you may have some up against something similar sorting out migrations with Kysely?
t
can you tell me more about why you want to avoid treeshaking?
You can set
bundle: false
right now to disable bundling
but the api for that isn't great if you stil want to use some other features
b
Been playing around with running migrations from a pist deploy
Script
again. Only hurdle i have left is when the lambda is bundled it doesn't contain any of the migration scripts, just the runner's index.js. I'm assuming that in order to get this working I need to play with the bundling stuff but wasn't 100% sure what to even play with.
t
Ah no there's another way to do this, checkout
bundle.copyFiles
b
Cool, thanks. I'd used copyFiles before for json but wasn't sure it was the way to go for this. Thanks for being a hero!
Ah balls, hadn't clocked it'd just move over the raw
.ts
files. Need to rethink this strategy i think 🤦
t
Are you using kysely? Or something else
b
Yea using Kysely
t
Ah did you see our new sst.RDS construct? It has migrations built in. We also didn't support TS migrations yet but we will
Just need to run them through esbuild before copying
b
I saw it earlier when someone had a question about it; the biggest pain in my ass is that I'm actually doing this using an RDS instance already defined elsewhere in Terraform and so need to import the resource rather than define it - wasted a whole day getting that working properly a few weeks ago haha. Couldn't see anything like that in the RDS Construct when I looked earlier. I'll look at my approach again, I'm sure there's a quick/good way to get this all wired up. Giving myself until COB tomorrow before I give up completely 😂
p
Wait, there's a new RDS construct with migration support??
Sorry thread hijacking
t
@Brinsley ah yeah our construct is really geared towards new projects. If a migration is in the cards DMS actually makes it possible to do a live migration to a CDK managed serverless RDS. And yeah @Patrick Gold we haven't promoted it too much but here: https://docs.serverless-stack.com/constructs/RDS There's a whole tab in the UI to run sql queries and migrations against local or prod stages
p
This could be game changing for me!
just need to get rid of my dumb bastion host...
Honestly though, with my recent random CDK updates, it makes me a bit nervous to attach it to the DB. 😅 want to figure that out first
t
Yeah my favorite part about it is because it has data api you can talk to it from a browser app (our console) so no need for VPCs, VPNs or a client you have to download
p
What. that's awesome
Sorry though, I'll start a new thread. Don't want to distract from the other convo
b
@thdxr thanks for the responses. I'll have a read up about DMS, see if it can make my offer a bit easier in the future - might be doing this with another database at some point. Just as an update, trued fighting with esbuild to build my non-imported files - ended up just using tsc 😂 @Patrick Gold haha no stress, I think I was resolved on this anyway