Skip to content

Commit

Permalink
Merge pull request #1136 from forcedotcom/sh/update-sfdx-url-doc
Browse files Browse the repository at this point in the history
fix: update error message for sfdx auth url
  • Loading branch information
WillieRuemmele authored Sep 11, 2024
2 parents 7994793 + 6e62b19 commit 7040113
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 4 additions & 0 deletions messages/core.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@ Errors encountered:

Error authenticating with the refresh token due to: %s

# invalidSfdxAuthUrlError

Invalid SFDX authorization URL. Must be in the format "force://<clientId>:<clientSecret>:<refreshToken>@<instanceUrl>". Note that the "instanceUrl" inside the SFDX authorization URL doesn\'t include the protocol ("https://"). Run "org display --target-org" on an org to see an example of an SFDX authorization URL.

# orgDataNotAvailableError

An attempt to refresh the authentication token failed with a 'Data Not Found Error'. The org identified by username %s does not appear to exist. Likely cause is that the org was deleted by another user or has expired.
Expand Down
10 changes: 4 additions & 6 deletions src/org/authInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -367,10 +367,7 @@ export class AuthInfo extends AsyncOptionalCreatable<AuthInfo.Options> {
);

if (!match) {
throw new SfError(
'Invalid SFDX auth URL. Must be in the format "force://<clientId>:<clientSecret>:<refreshToken>@<instanceUrl>". Note that the SFDX auth URL uses the "force" protocol, and not "http" or "https". Also note that the "instanceUrl" inside the SFDX auth URL doesn\'t include the protocol ("https://").',
'INVALID_SFDX_AUTH_URL'
);
throw new SfError(messages.getMessage('invalidSfdxAuthUrlError'), 'INVALID_SFDX_AUTH_URL');
}
const [, clientId, clientSecret, refreshToken, loginUrl] = match;
return {
Expand Down Expand Up @@ -1073,8 +1070,9 @@ export class AuthInfo extends AsyncOptionalCreatable<AuthInfo.Options> {
let authFieldsBuilder: TokenResponse;
try {
authFieldsBuilder = await oauth2.refreshToken(ensure(fullOptions.refreshToken));
} catch (err) {
throw messages.createError('refreshTokenAuthError', [(err as Error).message]);
} catch (err: unknown) {
const cause = err instanceof Error ? err : SfError.wrap(err);
throw messages.createError('refreshTokenAuthError', [cause.message], undefined, cause);
}

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
Expand Down

0 comments on commit 7040113

Please sign in to comment.