Benjamin Mitchell
02/14/2022, 10:02 AMAWS_PROFILE=uat npx sst start
I then go into the frontend
directory to try and run the nextjs front end using
npm run dev
(which is mapped as follows in package.json "dev": "sst-env -- next dev"
)
Which works fine, but when I load the page in a browser and click on the button wired up to an nextjs api function that calls DynamoDB via the AWS SDK I get this error after ~20 seconds:
“CredentialsError”,“message”:“Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1”Any ideas on what I can try? I’m not clear how the AWS SDK in the API function gets it’s AWS credentials information.
manitej
02/14/2022, 10:05 AMmanitej
02/14/2022, 10:07 AM.env
file in your project? @Benjamin MitchellBenjamin Mitchell
02/14/2022, 10:29 AMimport AWS from "aws-sdk";
const dynamoDb = new AWS.DynamoDB.DocumentClient({
region: process.env.REGION,
});
And I don’t have a .env
in that frontend folder or in that api folder.manitej
02/14/2022, 10:32 AMBenjamin Mitchell
02/14/2022, 10:34 AMaws --version
aws-cli/2.4.16 Python/3.9.10 Darwin/21.1.0 source/arm64 prompt/off
Benjamin Mitchell
02/14/2022, 10:34 AMmanitej
02/14/2022, 10:34 AM$ export AWS_ACCESS_KEY_ID="your_key_id"
$ export AWS_SECRET_ACCESS_KEY="your_secret_key"
manitej
02/14/2022, 10:37 AMcredentials
object during initializationBenjamin Mitchell
02/14/2022, 11:40 AMmanitej
02/14/2022, 11:41 AMthdxr
02/14/2022, 2:03 PMBenjamin Mitchell
02/14/2022, 4:42 PMSST: 0.63.0
but I think it may have been user-error on my side that caused my initial problem; when I copied the files over again I was able to get the frontend to connect to the API and the DynamoDB without issue.