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

fix: azure publish failed #5098

Merged
merged 5 commits into from
Dec 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Composer/packages/server/src/models/bot/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -467,7 +467,7 @@ export class Builder {
region: this.config.authoringRegion || '',
qnaRegion: this.config.qnaRegion || this.config.authoringRegion || '',
botName: this.config.name || '',
suffix: this.config.environment || '',
suffix: this.config.environment || 'composer',
fallbackLocal: this.config.defaultLanguage || 'en-us',
endpoint: this.config.endpoint || null,
authoringEndpoint: this.config.authoringEndpoint || null,
Expand Down
2 changes: 1 addition & 1 deletion extensions/azurePublish/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ export default async (composer: IExtensionRegistration): Promise<void> => {

// these are specific to the azure publish profile shape
name,
environment,
environment = 'composer',
settings,
accessToken,
} = config;
Expand Down
21 changes: 8 additions & 13 deletions extensions/azurePublish/src/luisAndQnA.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,6 @@ export async function publishLuisToPrediction(
luisEndpoint = `https://${luisAuthoringRegion}.api.cognitive.microsoft.com`;
}

logger({
status: BotProjectDeployLoggerType.DEPLOY_INFO,
message: 'start publish luis',
});

// Find any files that contain the name 'luis.settings' in them
// These are generated by the LuBuild process and placed in the generated folder
// These contain dialog-to-luis app id mapping
Expand All @@ -86,6 +81,13 @@ export async function publishLuisToPrediction(
Object.assign(luisAppIds, luisSettings.luis);
}

if(!Object.keys(luisAppIds).length) return luisAppIds;

logger({
status: BotProjectDeployLoggerType.DEPLOY_INFO,
message: 'start publish luis',
});

// In order for the bot to use the LUIS models, we need to assign a LUIS key to the endpoint of each app
// First step is to get a list of all the accounts available based on the given luisAuthoringKey.
let accountList;
Expand Down Expand Up @@ -131,14 +133,7 @@ export async function publishLuisToPrediction(
json: true,
headers: { Authorization: `Bearer ${accessToken}`, 'Ocp-Apim-Subscription-Key': luisAuthoringKey },
} as rp.RequestPromiseOptions;
const response = await rp.post(luisAssignEndpoint, options);

// TODO: Add some error handling on this API call. As it is, errors will just throw by default and be caught by the catch all try/catch in the deploy method

logger({
status: BotProjectDeployLoggerType.DEPLOY_INFO,
message: response,
});
await rp.post(luisAssignEndpoint, options);
}

// The process has now completed.
Expand Down