Skip to content

Commit

Permalink
fix: auth issue in export tests (#8710)
Browse files Browse the repository at this point in the history
* fix: auth issue in export tests

* fix: address comments
  • Loading branch information
akshbhu authored and sachscode committed Nov 11, 2021
1 parent d38c889 commit a0a657c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 3 additions & 2 deletions packages/amplify-category-auth/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,9 @@ async function externalAuthEnable(context, externalCategory, resourceName, requi
currentAuthName = await getAuthResourceName(context);
// check for migration when auth has been enabled
await checkAuthResourceMigration(context, currentAuthName);
const cliState = new AuthInputState(currentAuthName);
currentAuthParams = await cliState.loadResourceParameters(context, cliState.getCLIInputPayload());
const { provider } = serviceMetadata.Cognito;
const providerPlugin = context.amplify.getPluginInstance(context, provider);
currentAuthParams = providerPlugin.loadResourceParameters(context, 'auth', currentAuthName);

if (requirements.authSelections.includes('identityPoolOnly') && currentAuthParams.userPoolName) {
requirements.authSelections = 'identityPoolAndUserPool';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,13 @@ export class AuthInputState extends CategoryInputState {
}

public async saveCLIInputPayload(cliInputs: CognitoCLIInputs): Promise<void> {
// converting stringified triggers to object
if (!_.isEmpty(cliInputs.cognitoConfig.triggers)) {
cliInputs.cognitoConfig.triggers =
typeof cliInputs.cognitoConfig.triggers === 'string'
? JSONUtilities.parse(cliInputs.cognitoConfig.triggers)
: cliInputs.cognitoConfig.triggers;
}
if (await this.isCLIInputsValid(cliInputs)) {
fs.ensureDirSync(path.join(pathManager.getBackendDirPath(), this.#category, this._resourceName));
JSONUtilities.writeJson(this.#cliInputsFilePath, cliInputs);
Expand Down
3 changes: 1 addition & 2 deletions packages/amplify-e2e-core/src/export/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function exportPullBackend(cwd: string, settings: { exportPath: string; f
['export', 'pull', '--out', settings.exportPath, '--frontend', settings.frontend, '--rootStackName', settings.rootStackName],
{ cwd, stripColors: true },
)
.wait('Successfully generated frontend config files')
// .wait('Successfully generated frontend config files')
.sendEof()
.run((err: Error) => {
if (!err) {
Expand All @@ -33,4 +33,3 @@ export function exportPullBackend(cwd: string, settings: { exportPath: string; f
});
});
}

0 comments on commit a0a657c

Please sign in to comment.