Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Account Id is now optional #50

Open
wants to merge 1 commit into
base: expose-message-method
Choose a base branch
from

Conversation

amir27111998
Copy link
Contributor

No description provided.

@amir27111998 amir27111998 requested review from MGB247 and Rayyan98 and removed request for MGB247 August 8, 2023 08:33
} else {
const { region, accountId } = this.options.awsConfig;
if (!accountId)
this.getAwsAccountId(region).then((accountId) => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use async/await and try/catch

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a reason not using async await here because we have to call its outer function in constructor? I don't know can constructor supports asynchronous calls

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets discuss this
A lot of functions rely on accountId and making this asynchronous would mean that those functions break if called before the accountId is set

Comment on lines +112 to +113
if (!accountId) throw new Error('No Account Id Found.');
return accountId;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!accountId) throw new Error('No Account Id Found.');
return accountId;
if (!accountId) {
throw new Error('No Account Id Found.');
return accountId};

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How even this is possible to return Id after throwing error.

Copy link
Collaborator

@MGB247 MGB247 Aug 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!accountId) throw new Error('No Account Id Found.');
return accountId;
if (!accountId) {
throw new Error('No Account Id Found.');
}
return accountId;

is what I meant

@amir27111998 amir27111998 force-pushed the aws-account-id-optional branch from 5f9199b to cdb3655 Compare August 8, 2023 09:48
@amir27111998 amir27111998 requested a review from MGB247 August 8, 2023 09:58
@MGB247 MGB247 added the enhancement New feature or request label Aug 9, 2023
@Rayyan98 Rayyan98 requested review from Rayyan98 and removed request for Rayyan98 April 25, 2024 05:44
@Rayyan98 Rayyan98 removed their request for review May 24, 2024 06:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants