Skip to content
This repository was archived by the owner on Jan 15, 2025. It is now read-only.

Commit d4b719f

Browse files
authored
Fix for direct luis direct version publish (#798)
* Remove LUIS sdk and replace with direct http request * Removing unused line of code
1 parent fe47e31 commit d4b719f

File tree

1 file changed

+14
-4
lines changed
  • packages/luis/src/commands/luis/application

1 file changed

+14
-4
lines changed

packages/luis/src/commands/luis/application/publish.ts

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
import {CLIError, Command, flags} from '@microsoft/bf-cli-command'
7+
import fetch from 'node-fetch'
78

89
const utils = require('../../../utils/index')
910

@@ -41,17 +42,26 @@ export default class LuisApplicationPublish extends Command {
4142
const requiredProps = {endpoint, subscriptionKey, appId, versionId}
4243
utils.validateRequiredProps(requiredProps)
4344

44-
const client = utils.getLUISClient(subscriptionKey, endpoint)
45-
4645
const applicationPublishObject = {
4746
versionId,
4847
isStaging: staging,
4948
directVersionPublish: direct
5049
}
5150

5251
try {
53-
const publishedAppData = await client.apps.publish(appId, applicationPublishObject)
54-
this.log(`${JSON.stringify(publishedAppData, null, 2)}`)
52+
let url = endpoint + '/luis/authoring/v3.0-preview/apps/' + appId + '/publish'
53+
const headers = {
54+
'Content-Type': 'application/json',
55+
'Ocp-Apim-Subscription-Key': subscriptionKey
56+
}
57+
const response = await fetch(url, {method: 'POST', headers, body: JSON.stringify(applicationPublishObject)})
58+
const messageData = await response.json()
59+
60+
if (messageData.error) {
61+
throw new CLIError(messageData.error.message)
62+
}
63+
64+
this.log(`${JSON.stringify(messageData, null, 2)}`)
5565
} catch (err) {
5666
throw new CLIError(`Failed to publish app: ${err}`)
5767
}

0 commit comments

Comments
 (0)