aws / aws-sdk-js

AWS SDK for JavaScript in the browser and Node.js
https://aws.amazon.com/developer/language/javascript/
Apache License 2.0
7.57k stars 1.55k forks source link

For this specific case, an empty profile is passed in configFileSelector #4595

Closed sriharshini22 closed 2 months ago

sriharshini22 commented 3 months ago
          For this specific case, an empty profile is passed in configFileSelector

https://github.com/awslabs/smithy-typescript/blob/7de91ee308862ad62ed95fe9222f239221fa5a90/packages/config-resolver/src/regionConfig/config.ts#L17

Originally posted by @trivikr in https://github.com/aws/aws-sdk-js-v3/issues/5471#issuecomment-1804469182

sriharshini22 commented 3 months ago

This is the RegionConfig.js file

import { __assign } from "tslib";
export var REGION_ENV_NAME = "AWS_REGION";
export var REGION_INI_NAME = "region";
export var NODE_REGION_CONFIG_OPTIONS = {
    environmentVariableSelector: function (env) { return env[REGION_ENV_NAME]; },
    configFileSelector: function (profile) { return profile[REGION_INI_NAME]; },
    default: function () {
        throw new Error("Region is missing");
    },
};
export var NODE_REGION_CONFIG_FILE_OPTIONS = {
    preferredFile: "credentials",
};
export var resolveRegionConfig = function (input) {
    if (!input.region) {
        throw new Error("Region is missing");
    }
    return __assign(__assign({}, input), { region: normalizeRegion(input.region) });
};
var normalizeRegion = function (region) {
    if (typeof region === "string") {
        var promisified_1 = Promise.resolve(region);
        return function () { return promisified_1; };
    }
    return region;
};

I'm facing the error: Uncaught (in promise) Error: Region is missing

Deployment: npm run dev or yarn dev

RanVaknin commented 3 months ago

Hi @sriharshini22 since you didn't fill in the intake form its difficult for us to understand what the issue is.

The error specifies that you are not providing are a region when setting the config on the client.

Are you able to share your actual code?

Thanks, Ran~

github-actions[bot] commented 2 months ago

This issue has not received a response in 1 week. If you still think there is a problem, please leave a comment to avoid the issue from automatically closing.