Self-hosted update erroneously references -us-east...
# support
c
I was attempting to update our AWS self-hosted application. When running
yarn medplum aws update-app dev
(note that we use Yarn with a specific version of the CLI etc) for the latest 2.1.4, I get the following error:
Error: Stack with id MedplumDev-us-east-1 does not exist
It looks like there is a specialized
-us-east-1
stack created if the primary stack is NOT in this region. However, ours is, so I'm not sure why it is looking for a stack with this name. Our
medplum.dev.config.json
in the same directory is as follows:
Copy code
{
  "apiPort": 8103,
  "region": "us-east-1",
  "name": "dev",
  "accountNumber": "...",
  "stackName": "MedplumDev",
  "domainName": "medplum...",
  "apiDomainName": "api...",
  "baseUrl": "https://api...",
  "appDomainName": "app...",
  "storageDomainName": "storage...",
  "storageBucketName": "...",
  "maxAzs": 2,
  "rdsInstances": 1,
  "desiredServerCount": 1,
  "serverMemory": 512,
  "serverCpu": 256,
  "serverImage": "medplum/medplum-server:latest",
  "signingKeyId": "...",
  "storagePublicKey": "...",
  "apiSslCertArn": "...",
  "appSslCertArn": "...",
  "storageSslCertArn": "..."
}
I skimmed the Medplum codebase but could not see why this would be happening - code blocks seem to correctly gate on the configured
region
... I did notice this PR, which does something related to region - we are updating from a version older than this: https://github.com/medplum/medplum/pull/2879
I tried setting
AWS_REGION
in my shell (I recall this being necessary for installation maybe?) but it didn't make a difference
a
Same is happening to me, for a fresh deploy to aws us-east-1. Here the versions of the dependencies
Copy code
"dependencies": {
    "@medplum/cdk": "^2.1.4",
    "@medplum/cli": "^2.1.4",
    "aws-cdk-lib": "^2.88.0",
    "cdk": "^2.88.0",
    "constructs": "^10.2.69"
  }
Looks like
buildStackDetails()
is looking for
stackName + '-us-east-1'
. But stack is not being created with region sufix attached to it. 🤔
await buildStackDetails(new CloudFormationClient({ region: 'us-east-1' }), stackName + '-us-east-1', result);
https://github.com/medplum/medplum/blob/main/packages/cli/src/aws/utils.ts#L72C11-L72C28 I think it is failing in this line
const describeStacksCommand = new DescribeStacksCommand({ StackName: stackName });
https://github.com/medplum/medplum/blob/main/packages/cli/src/aws/utils.ts#L88C37-L88C58 My ideas of what I understand is happening. * My region is set to
us-east-1
. So, the code is only creating
MedplumPrimaryStack
, but not
MedplumGlobalStack
. * cli
aws
should have the same logic to detect when region is not set to
us-east-1
. So
deploy-app/update-app
points to
us-east-1
? (Cheeeeecking, bc cli has the same logic 🤔 https://github.com/medplum/medplum/blob/main/packages/cli/src/aws/utils.ts#L71 ) https://github.com/medplum/medplum/blob/8baa1326ab6197be561b82ae5db9aee1fe1c34f6/packages/cdk/src/stack.ts#L15 In the mean time. I was able to run
deploy-app
using medplum/cli 2.0.31 version
c
When deploying Medplum outside of us-east-1, you still unfortunately need a us-east-1 stack for "global" resources such as Route 53 DNS entries and CloudFront distributions.
I'm looking at why you might get that error...
@codingtom - just to confirm, you get the error even when using
AWS_REGION=us-east-1 medplum aws update-app
? The logic for looking for the extra stack is here: https://github.com/medplum/medplum/blob/main/packages/cli/src/aws/utils.ts#L71
Copy code
if (cloudFormationClient.config.region !== 'us-east-1') {
I can research why that condition would be false even if setting
AWS_REGION=us-east-1
:/
c
I used
export
followed by the
medplum
command, but yes it seemed to have the same behavior
163 Views