serverless / compose

Orchestrate Serverless Framework in monorepos
https://serverless.com/framework/docs/guides/compose
MIT License
111 stars 15 forks source link

The AWS profile is not taken into account when deploying #120

Closed mnapoli closed 2 years ago

mnapoli commented 2 years ago

I have 3 AWS profiles setup on my system. Howver, I am having issues with using any of these profiles except the default one. None of the options above work for me.

Originally posted by @mkarsene in https://github.com/serverless/compose/issues/113#issuecomment-1126948205

mnapoli commented 2 years ago

@mkarsene I'm surprised that provider.profile doesn't work. Could you clarify:

I'm trying to identify if the issue is related to Compose or not.

Have you managed to make the profiles work before using Compose?

mkarsene commented 2 years ago

@mnapoli I am using serverless.ts but I assume this has no effect on any of this?

mnapoli commented 2 years ago

Got it. serverless.ts instead of serverless.yml should have no impact here.

Could you post the full serverless.ts file (with sensitive parts removed)? I want to see if there's anything else that might override the AWS profile configuration.


Regarding serverless-compose.ts, you cannot set '.' or '' as a path: the service has to be in a different directory. This is because else serverless deploy cannot decide if it should run Compose or Serverless Framework (because both config files are in the same directory).

This is something we want to improve/solve in the future.

mkarsene commented 2 years ago

I believe my issue was that I'd set the AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY env params in windows. These somehow took precedence over the provider.profile variable in any serverless.ts. deleting those from the windows env solved it...

pgrzesik commented 2 years ago

Hey @mkarsene - that's definitely the case - the environment variables always take precedence over the profile setting

mnapoli commented 2 years ago

👍

Let's close this issue then as it seems the problem was identified.

mkarsene commented 2 years ago

I think we can close this issue then...thanks @mnapoli

muddahany commented 2 years ago

I am having a similar issue to that one, where I am having a Makefile that basically loads up the AWS credential inside a profile. We are using the same Makefile for other services with serveless just fine. In this case here; we are creating a newly monorepo service with serverless-compose with multiple packages, I am trying to set the aws-profile for deploying. However the following issues happened when we tried the 3 approaches mentioned earlier.