console icon indicating copy to clipboard operation
console copied to clipboard

Autodeploy not working as expected in a monorepo

Open dhoulker opened this issue 1 year ago • 4 comments

We have been using Autodeploy on our project.

We have a Turborepo monorepo, and we import some shared config from a local package in our sst.config.ts

With this approach the Autodeploy service is not able to read our sst config and the deploy fails, we see Error evaluating sst.config.ts

CleanShot 2024-07-25 at 06 53 28@2x

Once we replace the shared config with actual values the deploy works great.

Let me know if you need a reproducible example, or if i've raised this in the right place.

dhoulker avatar Jul 25 '24 05:07 dhoulker

Yeah can you share what you've added to your sst config? We try and strip the imports but what's happening is that it's trying to eval it in an environment that doesn't have these dependencies. This gets done before the actual build is run.

jayair avatar Jul 26 '24 21:07 jayair

Here's repo for you - https://github.com/dhoulker/sst-monorepo-sandbox

  • Local deploy (sst deploy --stage dev) ✅
  • Branch deploy using AutoDeploy (region just set normally) ✅
  • Branch deploy using AutoDeploy (region pulled in from utils package just as contrived example) ❌

Local deploy works irrespective of how the region is set.

Let me know if you need anything else, dev branch is the one you need above.

You can see my attempts below

CleanShot 2024-07-29 at 13 15 38@2x

Thanks!

dhoulker avatar Jul 29 '24 12:07 dhoulker

Yeah I don't think this'll quite work. Because of what I was mentioning above. I know you said it's a contrived example but in your real use case is it the region that you are setting through an import?

jayair avatar Aug 02 '24 21:08 jayair

Our use case is that we have multiple sst projects in the repo and would to share some config, eg stage name.

Its not a huge problem, if this is a limitation i'm sure we can work round it.

dhoulker avatar Aug 03 '24 06:08 dhoulker