Good afternoon, I am hoping someone can help me wi...
# seed
m
Good afternoon, I am hoping someone can help me with my latest sticking point. I am trying to create an after_deploy step in seed that does some database stuff, specifically setting up some mappings in opensearch. When I try to run my code it goes to the parameter store to get the opensearch_host, However when I run the code in the after_deploy the parameter is not found. I have been working on this all afternoon and just checked the parameter store from the command line, and it is return an empty result, however when I look in the AWS console, the results are there. Also I can run my code locally and it sees the parameters. According to the seed docs: https://seed.run/docs/adding-a-build-spec "The scripts in your build spec are run in an environment that are using your AWS IAM credentials. This means that you can directly use any AWS commands in your script using the AWS CLI without having to configure it." This is the output from the after_deploy:
Copy code
$ aws ssm get-parameters-by-path --path "/" --recursive
{
    "Parameters": []
}
Same command from local: (chartflow) Michaels-MacBook-Pro-3:chartflow dramus$ aws ssm get-parameters-by-path --path "/" --recursive {   "Parameters": [     {       "Name": "/all/SMTP_PASSWORD",       "Type": "SecureString",       "Value": Stuff",       "Version": 1,       "LastModifiedDate": 1643163743.53,       "ARN": "arnawsssmus east 2309833148800:parameter/all/SMTP_PASSWORD",       "DataType": "text"     },     {       "Name": "/all/SMTP_SERVER",       "Type": "String",       "Value": "email-smtp.us-east-2.amazonaws.com",       "Version": 1,       "LastModifiedDate": 1643170101.049,       "ARN": "arnawsssmus east 2309833148800:parameter/all/SMTP_SERVER",       "DataType": "text"     },     {       "Name": "/all/SMTP_USER",       "Type": "SecureString",       "Value": "Stuff",       "Version": 1,       "LastModifiedDate": 1643163685.099,       "ARN": "arnawsssmus east 2309833148800:parameter/all/SMTP_USER",       "DataType": "text"     },     {       "Name": "/cdk-bootstrap/hnb659fds/version",       "Type": "String",       "Value": "9",       "Version": 1,       "LastModifiedDate": 1642023965.502,       "ARN": "arnawsssmus east 2309833148800:parameter/cdk-bootstrap/hnb659fds/version",       "DataType": "text"     },     {       "Name": "/dev/opensearch_host",       "Type": "String",       "Value": "search-chartflowae59de-ipefpfwnakou-swkpxkmobnasn5zvsxwyaat2ri.us-east-2.es.amazonaws.com",       "Version": 1,       "LastModifiedDate": 1643928838.509,       "ARN": "arnawsssmus east 2309833148800:parameter/dev/opensearch_host",       "DataType": "text"     },     {       "Name": "/dev/siteurl",       "Type": "String",       "Value": "https://dev.chartflow.io",       "Version": 1,       "LastModifiedDate": 1643928000.281,       "ARN": "arnawsssmus east 2309833148800:parameter/dev/siteurl",       "DataType": "text"     },     {       "Name": "/mike-local/opensearch_host",       "Type": "String",       "Value": "search-chartflowae59de-eswdty9vhjlr-yqn5hfbgznl72f7fk65ptiwgfm.us-east-2.es.amazonaws.com",       "Version": 2,       "LastModifiedDate": 1643240214.242,       "ARN": "arnawsssmus east 2309833148800:parameter/mike-local/opensearch_host",       "DataType": "text"     },     {       "Name": "/mike-local/siteurl",       "Type": "String",       "Value": "https://mike-local.chartflow.io:3000",       "Version": 2,       "LastModifiedDate": 1643393922.827,       "ARN": "arnawsssmus east 2309833148800:parameter/mike-local/siteurl",       "DataType": "text"     }   ] }
t
is it possible it's using the wrong region?
m
That does seem to be the problem. Just printed the Env Variables and sure enough AWS_REGION is set to us-east-1 and I am on us-east-2. I would expect that the AWS_REGION would be set to the region being deployed to which is us-east-2
I don't see anything in the environment variables that shows the correct region that was deployed to
Setting the Region manually in the SEED stage to match the region in the sst.json file fixed the issue. Thanks for your help. I would recommend someone add something to the seed docs for the build spec to mention that the region won't match if you leave the the seed config set to default and your sst.json default region is not us-east-1