Skip to content

Commit

Permalink
fix: azure publish failed (microsoft#5098)
Browse files Browse the repository at this point in the history
* fix: azure publish failed

* remove responce

Co-authored-by: Lu Han <[email protected]>
Co-authored-by: Dong Lei <[email protected]>
  • Loading branch information
3 people authored Dec 4, 2020
1 parent 2a5d599 commit 98eb0f2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
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

0 comments on commit 98eb0f2

Please sign in to comment.