Open Bug 1105257 Opened 10 years ago Updated 2 months ago

Fix compatibility layer for querying bug details: [SyntaxError: Unexpected end of input]

Categories

(bugzilla.mozilla.org :: Extensions, defect)

Production
defect
Not set
normal

Tracking

()

People

(Reporter: whimboo, Unassigned)

Details

Attachments

(1 obsolete file)

As Ed pointed out on bug 1105141 comment 6, I will file this bug to get the compatibility layer fixed.

Due to bug 1105141 we had problems with out automation bot (https://github.com/AutomatedTester/automation-services-bot/) instance running in our #automation IRC channel.

The failure as visible was: [SyntaxError: Unexpected end of input]

The code you might want to be interested in, is here:
https://github.com/AutomatedTester/automation-services-bot/blob/41baf85c1dee82aa664b9c704d38bd8d55b5e2f7/bot.js#L102
(In reply to Henrik Skupin (:whimboo) from comment #0)
> As Ed pointed out on bug 1105141 comment 6, I will file this bug to get the
> compatibility layer fixed.
> 
> Due to bug 1105141 we had problems with out automation bot
> (https://github.com/AutomatedTester/automation-services-bot/) instance
> running in our #automation IRC channel.
> 
> The failure as visible was: [SyntaxError: Unexpected end of input]

do you know if that's the response received from bmo, or if that's output from your code?
(my guess is it's output from your code).
 
> The code you might want to be interested in, is here:
> https://github.com/AutomatedTester/automation-services-bot/blob/
> 41baf85c1dee82aa664b9c704d38bd8d55b5e2f7/bot.js#L102

from that code the request looks very simple - with the redirect in place we'd end up with https://bugzilla.mozilla.org/bzapi/bug?id=1105257
can you please provide an actual url that was triggering this issue?

note - you're requesting all fields, but only using 4.  you should really be passing "include_fields".
ie. https://bugzilla.mozilla.org/bzapi/bug?id=1105257&include_fields=summary,severity,status,resolution
Flags: needinfo?(hskupin)
Blocks: 1098342
(In reply to Byron Jones ‹:glob› from comment #1)
> > The failure as visible was: [SyntaxError: Unexpected end of input]
> 
> do you know if that's the response received from bmo, or if that's output
> from your code?
> (my guess is it's output from your code).

The bot doesn't output any traceback. Maybe David might still know more about it given that he is the original developer.

> > The code you might want to be interested in, is here:
> > https://github.com/AutomatedTester/automation-services-bot/blob/
> > 41baf85c1dee82aa664b9c704d38bd8d55b5e2f7/bot.js#L102
> 
> from that code the request looks very simple - with the redirect in place
> we'd end up with https://bugzilla.mozilla.org/bzapi/bug?id=1105257
> can you please provide an actual url that was triggering this issue?
> 
> note - you're requesting all fields, but only using 4.  you should really be
> passing "include_fields".
> ie.
> https://bugzilla.mozilla.org/bzapi/bug?id=1105257&include_fields=summary,
> severity,status,resolution

Thanks. We will make sure to fix that via https://github.com/AutomatedTester/automation-services-bot/issues/37
Flags: needinfo?(hskupin) → needinfo?(dburns)
(In reply to Henrik Skupin (:whimboo) from comment #2)
> (In reply to Byron Jones ‹:glob› from comment #1)
> > > The failure as visible was: [SyntaxError: Unexpected end of input]
> > 
> > do you know if that's the response received from bmo, or if that's output
> > from your code?
> > (my guess is it's output from your code).
> 
> The bot doesn't output any traceback. Maybe David might still know more
> about it given that he is the original developer.
> 

Without trying to debug this I don't know where the error is coming from. This is quite low on my priority list too so perhaps someone else can look into
Flags: needinfo?(dburns)
I tried to have a quick look at this, but it's going to take longer than I can justify taking away from Treeherder due to:
https://github.com/AutomatedTester/automation-services-bot/issues/40
https://github.com/AutomatedTester/automation-services-bot/issues/39
(and to a lesser extent https://github.com/AutomatedTester/automation-services-bot/issues/38)

As such, someone else will need to look into this if it needs resolving in the short term.

I would suggest manually changing the endpoint used (https://github.com/AutomatedTester/automation-services-bot/blob/41baf85c1dee82aa664b9c704d38bd8d55b5e2f7/bot.js#L103) to rule out whether the redirect used previously was the cause of the breakage (vs the new endpoint itself).

Once that is done, I'm happy to assist anyone with debugging the bzapi interaction side.

Note that IMO this shouldn't block bug 1098342 until it's proven that there is a problem with the bzapi compatibility layer, so it's probably better that this is investigated sooner rather than later, otherwise the bot will stop working when that is redeployed.
(In reply to Ed Morley (moved to Treeherder) [:edmorley] from comment #4)
> I would suggest manually changing the endpoint used
> (https://github.com/AutomatedTester/automation-services-bot/blob/
> 41baf85c1dee82aa664b9c704d38bd8d55b5e2f7/bot.js#L103) to rule out whether
> the redirect used previously was the cause of the breakage (vs the new
> endpoint itself).

The code there is doing GET which should work with a standard redirect. Our main issue from what I can remember was that POST/PUT requests were being converted to GET unintentionally.

(In reply to Henrik Skupin (:whimboo) from comment #0)
> As Ed pointed out on bug 1105141 comment 6, I will file this bug to get the
> compatibility layer fixed.
> 
> Due to bug 1105141 we had problems with out automation bot
> (https://github.com/AutomatedTester/automation-services-bot/) instance
> running in our #automation IRC channel.
> 
> The failure as visible was: [SyntaxError: Unexpected end of input]
> 
> The code you might want to be interested in, is here:
> https://github.com/AutomatedTester/automation-services-bot/blob/
> 41baf85c1dee82aa664b9c704d38bd8d55b5e2f7/bot.js#L102

I would need to get the value stored in apiReesult upon failure condition to see what is happening.

Question about the code:

> res.on('end', function(){
>   var returnMessage = '';
>   try{
>     data = JSON.parse(apiResult);
>     url = "https://bugzilla.mozilla.org/show_bug.cgi?id=" + bugID;
>     if (data["bugs"].length === 0){
>       returnMessage = "I can not see this bug, try clicking on " + url + " to see if it exists";
>       logger.log({channel:to, from:nick, message:returnMessage});
>       client.say(to, returnMessage);
>       return;
>     }
>     summary = data["bugs"]["0"]["summary"];severity = data["bugs"]["0"]["severity"];
>     status = data["bugs"]["0"]["status"];
>     resolution = data["bugs"]["0"]["resolution"];

Does "0" work in the above as it seems like it would be looking for a literal key name in a data["bugs"] object instead of the 0 element of a list?

Does data["bugs"][0]["summary"] work better?

>     returnMessage = "Bug " + url + " " + severity + ", " + status + " " + resolution + ", " + summary;
>     logger.log({channel:to, from:nick, message:returnMessage});
>     client.say(to, returnMessage);
>   }catch(e){
>     console.error(e);
>   }
> });
Flags: needinfo?(hskupin)
hskupin: this bug is one of the ones which blocks us from decommissioning the api-dev server. Please could you work with dkl to get it resolved?

Thanks :-)

Gerv
Sorry but I'm totally swamped with work right now and do not have time for that bug at the moment. I could suggest that someone of you just clone https://github.com/AutomatedTester/automation-services-bot/ and run the bot in a test channel. Then you can play with this redirect.
Flags: needinfo?(hskupin)
I tried looking into it briefly before, but hit the issues in comment 4. They are all things that could be worked around with enough time, but I'm pretty short of that at the moment.

Given this is just a bot, I think we should not make this block bug 1098342 for now (given bug 1082028 comment 4) - for a start it will be easier to test once it's failing - if it even does so (other fixes have landed to the compat layer since).
No longer blocks: 1098342
OS: Linux → All
Hardware: x86_64 → All
Component: Extensions: BzAPI Compatibility → Extensions
Attachment #9383034 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: