microsoft / BotFramework-Composer

Dialog creation and management for Microsoft Bot Framework Applications
https://docs.microsoft.com/en-us/composer/
MIT License
868 stars 372 forks source link

Publish Error JSON SyntaxError v1.3 #5344

Closed lucasdodgson closed 3 years ago

lucasdodgson commented 3 years ago

Hi, Just updated to v1.3 and tried to publish with the same profile as I had used in v1.2. Running locally works, although when publishing I get the following error: SyntaxError - Unexpected token o in JSON at position 1

Below is the log:

"Assigning to luis app id: removed"


"{\"name\":\"StatusCodeError\",\"statusCode\":400,\"message\":\"400 - {\\"error\\":{\\"code\\":\\"BadArgument\\",\\"message\\":\\"Failed to parse azure account information object object.\\"}}\",\"error\":{\"error\":{\"message\":\"Failed to parse azure account information object object.\"}},\"options\":{},\"response\":{\"statusCode\":400},\"stack\":\"StatusCodeError: 400 - {\\"error\\":{\\"code\\":\\"BadArgument\\",\\"message\\":\\"Failed to parse azure account information object object.\\"}}\n at new i (E:\\Program Files\\BotFrameWorkComposer\\Bot Framework Composer\\resources\\app.asar.unpacked\\extensions\\azurePublish\\lib\\node\\index.js:488:110568)\n at F.callback (E:\\Program Files\\BotFrameWorkComposer\\Bot Framework Composer\\resources\\app.asar.unpacked\\extensions\\azurePublish\\lib\\node\\index.js:488:109411)\n at F.e.callback.t.callback [as _callback] (E:\\Program Files\\BotFrameWorkComposer\\Bot Framework Composer\\resources\\app.asar.unpacked\\extensions\\azurePublish\\lib\\node\\index.js:488:108459)\n at F.t._callback.t.callback.t.callback (E:\\Program Files\\BotFrameWorkComposer\\Bot Framework Composer\\resources\\app.asar.unpacked\\extensions\\azurePublish\\lib\\node\\index.js:518:4015)\n at F.emit (events.js:210:5)\n at F. (E:\\Program Files\\BotFrameWorkComposer\\Bot Framework Composer\\resources\\app.asar.unpacked\\extensions\\azurePublish\\lib\\node\\index.js:518:16712)\n at F.emit (events.js:210:5)\n at IncomingMessage. (E:\\Program Files\\BotFrameWorkComposer\\Bot Framework Composer\\resources\\app.asar.unpacked\\extensions\\azurePublish\\lib\\node\\index.js:518:15544)\n at Object.onceWrapper (events.js:299:28)\n at IncomingMessage.emit (events.js:215:7)\n at endReadableNT (_stream_readable.js:1183:12)\n at processTicksAndRejections (internal/process/task_queues.js:80:21)\"}"


"{\"stack\":\"SyntaxError: Unexpected token o in JSON at position 1\n at JSON.parse ()\n at Object. (E:\\Program Files\\BotFrameWorkComposer\\Bot Framework Composer\\resources\\app.asar.unpacked\\extensions\\azurePublish\\lib\\node\\index.js:542:114757)\n at E:\\Program Files\\BotFrameWorkComposer\\Bot Framework Composer\\resources\\app.asar.unpacked\\extensions\\azurePublish\\lib\\node\\index.js:542:111883\n at Object.throw (E:\\Program Files\\BotFrameWorkComposer\\Bot Framework Composer\\resources\\app.asar.unpacked\\extensions\\azurePublish\\lib\\node\\index.js:542:111988)\n at s (E:\\Program Files\\BotFrameWorkComposer\\Bot Framework Composer\\resources\\app.asar.unpacked\\extensions\\azurePublish\\lib\\node\\index.js:542:110753)\",\"message\":\"Unexpected token o in JSON at position 1\"}"


"SyntaxError - Unexpected token o in JSON at position 1"

a-b-r-o-w-n commented 3 years ago

@luhan2017 can you investigate this issue?

luhan2017 commented 3 years ago

@lucasdodgson,could you share your profile? I can't reproduce this issue on my side.

a-b-r-o-w-n commented 3 years ago

@sriget @lucasdodgson Can you provide your appsettings.json file (with secrets redacted)?

sriget commented 3 years ago

@sriget @lucasdodgson Can you provide your appsettings.json file (with secrets redacted)?

This is my app settings json from bot. After i click publish, i see luis keys and pwds are cleared out of json file. Hope that is expected.

appsettings_issue.txt

lucasdodgson commented 3 years ago

Attached is mine as well.

appsetting_issue.txt

luhan2017 commented 3 years ago

@lucasdodgson , is your luis resource provisioned through composer? you may need to add luisResource in your publish profile. Please refer to the details here. https://github.com/microsoft/BotFramework-Composer/issues/5354#issuecomment-747150353

lucasdodgson commented 3 years ago

@luhan2017 The lines are present in the publish profile.

Trying to play around though I have observe two things, maybe they are helpful.

  1. I believe I am not loging into the directoy in which my azure subscription is in (as Composer login is not prompting me to enter my 2FA). Is there any way of specifying this?

  2. If I try to provision a publish profile through composer, it just says loading forever. This happens after having logged in, so might be related to 1.

cameroncharles commented 3 years ago

I am also getting this error, i had to create a new profile in 1.3 but it looks very similar to the one for another bot that was created in 1.2, said bot also publishes just fine in 1.3 the only difference between the 2 is LUIS

i have the hostname and luisResource values set and the json for both the profile and the settings is valid, but i still get this error

Rekeyea commented 3 years ago

Same issue here. Both the inability to publish from composer due to something with luis and the composer never finishing loading when trying to provision a profile with resources created from composer.

sshaque1 commented 3 years ago

Just managed to publish successfully my test bot from Bot Framework Composer to my Azure account using using version 1.3.0.

I resolved the "SyntaxError - Unexpected token o in JSON at position 1" error by logging into my Work/School account from the composer as oppose to Personal account.

So, all the resource information i used with "node provisionComposer.js" command referred to my Work/School account's subscription.

The solution actually triggered when I read this post: #5393 - Impossible to sign in to personal account to create a publish profile.

manuelserradev commented 3 years ago

Exact same problem here.

sshaque1 commented 3 years ago

Exact same problem here.

@nitroin: are you using work/school account or personal account?

Pajani commented 3 years ago

@sshaque1 , I am facing the same issue, i could not publish my bot into azure.

Just managed to publish successfully my test bot from Bot Framework Composer to my Azure account using using version 1.3.0.

I resolved the "SyntaxError - Unexpected token o in JSON at position 1" error by logging into my Work/School account from the composer as oppose to Personal account.

So, all the resource information i used with "node provisionComposer.js" command referred to my Work/School account's subscription.

The solution actually triggered when I read this post: #5393 - Impossible to sign in to personal account to create a publish profile.

i am also facing the issue, could not publish my bot into azure. i am using luis and bot composer v1.3. Getting error "" we could not find a work or school account with the email address""

i am using personal account.

DavidStrickland0 commented 3 years ago

Any updates on this? I took an Unaltered Echobot and published it and did not receive this error (Got a different one [#5628 ]) Added a Trigger to the one dialog in the Echobot. Ran it locally just fine. But Blew up with "Unexpected token o in JSON at position" when I tried to publish Definitely seems LUIS related. I have Luis Authoring and Endpoints created and the Intent publishes when I run it locally. But something blows a fuse when I try to Publish explicitly.

Not certain if its related but the instance I'm using for just about everything are Free or Free tier... Unfortunately can't switch to standard to test but thought it might be worth pointing out in case its one of those hidden Azure Pay Wall "features".

VanyLaw commented 3 years ago

@DavidStrickland0 is your luis resource provisioned through composer? you may need to add luisResource in your publish profile. Please refer to the details here.

5354 (comment)

cameroncharles commented 3 years ago

to put an update here, still getting the error when attempting to publish to existing azure resources, however in 1.3 there is the option to have bot framework composer provision you a set of resources to then publish too, we did this and it publishes perfectly fine, besides the different names and keys there were no major differences in the publish profile to point out though.

DavidStrickland0 commented 3 years ago

Moving a short version of @luhan2017 's work around here.

In short it appears there are two missing properties in the publication Profile. That can cause an error. The Json parsing one can be caused by a missing "luisResource" property.

{ "name": "Luhan0603AF", "environment": "dev", "hostname": "Luhan0603AF-dev", ------------------> This is the name of your webapp. "luisResource": "Luhan0603AF-dev-luis", ----------------> This is the name of your luis prediction service.

luhan2017 commented 3 years ago

@VanyLaw Let's update the error message, we should say: Failed to bind luis prediciton resource to luis applications. Please check if your luisResource is set to luis prediction service name in your publish profile.

cameroncharles commented 3 years ago

for the record, adding "luisResource" did not help me when i originally encountered this issue, i think there was another github issue that mentioned it as a possible solution, that and hostname, futhermore as mentioned above, my now fully working profile is near identical to the one that doesnt work

compulim commented 3 years ago

@luhan2017 I am DRI this week.

Is this a bug on the error message we put in Composer? Or is this a confusion while we are discussing about this issue?

cwhitten commented 3 years ago

@luhan2017 can you please update this thread or drive it to closure? thank you

danielgoldszmit commented 3 years ago

Moving a short version of @luhan2017 's work around here.

In short it appears there are two missing properties in the publication Profile. That can cause an error. The Json parsing one can be caused by a missing "luisResource" property.

{ "name": "Luhan0603AF", "environment": "dev", "hostname": "Luhan0603AF-dev", ------------------> This is the name of your webapp. "luisResource": "Luhan0603AF-dev-luis", ----------------> This is the name of your luis prediction service.

Adding the luisResource fix the issue using V1.4