Webiny local deploy AWS error 'Missing region in config'

Hello,

I’m stuck at this point, I’ve tried many things without results. The .aws/credentials file is been reading well (doing aws sts get-caller-identity, I’m receiving the correct response), but the .aws/config doesn’t.

I’ve try using a environment variable directly export [AWS_DEFAULT_REGION]= eu-central-1 (I’m working in mac) and also I’ve try to set AWS_SDK_LOAD_CONFIG=1.

I’ve tried all that I’ve found. I know that the problem is on connecting to AWS, but maybe you can help me.

My example.env.json
{
“default”: {
“AWS_PROFILE”: “default”,
“AWS_REGION”: “eu-central-1”,
“MONGODB_SERVER”: “myData”,
“MONGODB_NAME”: “myData”,
“DEBUG”: true
}
}

Node version: v11.1.0
Yarn version: 1.22.4

Thank you

Hi @Gala,

what is the full path of the config?

Just double checking, were you looking your actual home folder? So ~/.aws/config?

Thanks!

@Gala if you want to use the variables that are exported by you manually, then make sure you remove those variables from .env.json, as they will overwrite your exported values.

Btw. is this a new project you’ve created using create-webiny-project or is it our repository clone? If it’s our repository, please follow this guide on instructions how to set it up for development: https://github.com/webiny/webiny-js/blob/develop/docs/CONTRIBUTING.md

Yes, both (config and credentials) files are under the same folder ~/.aws

I created it using your CLI npx create-webiny-project new-project --template=cms.

I’m not understanding well this point. If I setup the AWS credentials and region using the AWS CLI, I have to remove "AWS_REGION": "eu-central-1" on the .env.json ?

I’ve have tried it again, deleting the AWS_REGION in the config.json, but still I’m having the same issue.

Anyway, I think that shouldn’t mind if them are overwritten, because I wrote the same value for the AWS_REGION and AWS_DEFAULT_REGION.

Thank you for the fast reply

As long as you have the correct AWS_REGION and AWS_PROFILE in your <root>/.env.json Webiny will just load those values and AWS SDK will work using them.

I don’t know then where is the mistake, checking my AWS console, the region is us-east-2, and I’ve change it, but still I’m receiving the same error message:

image

This is my .config.json
image

And my config file in ~/.aws/config (here I’ve trying adding and not adding the output=json):
image

To cover all bases here:
Perhaps make sure that the name of the config file is
.env.json
Otherwise I would recommend trying in a new folder with this command:
npx create-webiny-project sample-project
Then change the .env.json with the mongodb string once again.
Also make sure when you run yarn webiny deploy api --env=local it is in the directory of your project since one thing that might be happening is if you run that command and the .env.json isn’t present, it won’t pick up your aws configuration

As @EmilK15 correctly pointed out, Webiny is only loading files name exactly .env.json. Make sure your file is called exactly that. Also, in your very first post you said you have a file example.env.json which makes me wonder if your project got created correctly. There should not be such a file if a project is correctly created.

Please try creating a project from scratch. Most likely it will resolve all your issues.

Cheers!

That was the problem, the project has been created with many example. may I get rid of all this ‘example’ prefix deleting it? Tomorrow I’ll create a new one to check if again the same files are created, or maybe is it something that happens when the project is created using --template=cms parameter maybe

At least now I have a different error, the wrong name file was the problem

Thank you

@Gala renaming those files will not fix the issue. If project creation fails, there is more stuff that went wrong than just file names.

Don’t try to fix it, just create a new project and pay attention to the output of create-webiny-project command to see if it throws some errors. Sometimes a simple npm glitch can cause everything to go south, so a simple retry usually helps.

Let us know how it goes :slight_smile:

Perfect, then, will create a new one checking well the logs, and let you know the results.

Thank you so much

1 Like

I’ve insisted in install it with --template=cms, and here is the error, now I’m recalling that I installed the dependencies after it by my self using yarn install, checking the project, again files starting whit example. :

After it, I’ve tried with npx create-webiny-project new-project (–template with the default value) and I had the exact same result.

Node version 11.1.0
Yarn version 1.22.4

Maybe the Webiny installation itself had the problem, I’m going to try to install it again.

@Gala this is not normal, let’s try debugging this by logging the output. So, create the project using the following command npx create-webiny-project my-project --template=cms --log. The --log parameter will store all the output from yarn into a file at my-project/logs.txt.

Please post it here once you have it! Thanks!

1 Like

@pavel the problem seems to be de node version, weird because in the guide sais node.js >= 10.14.0

Using node version 11.10.1 works the creation and no more files prefixing with example.

1 Like

@Gala great, I think we never tried running it with node 11, we either have node 10 or 12…
Sorry for the troubles and thanks for seeing it through, we’ll add a check for that :slight_smile:

1 Like