Tasks API- Syntax Error Excluding Running Tasks

Using Octopus 3.3.19, we get a SQL Syntax error when we try to use the tasks API to find a list of non-running tasks.

http:///api/tasks/?running=False&apikey=

We get the following error:

Error while executing SQL command: Incorrect syntax near ‘Queued’.
The command being executed was:
SELECT COUNT(*) FROM dbo.[ServerTask] WHERE ([State] in (‘Canceled’, ‘Failed’, ‘Success’, ‘TimedOut’ ‘Queued’))

(It looks like there’s a simple typo in the SQL, a missing comma between TimedOut and Queued.)

Looking over the release notes I don’t see any fixes to resolve problems like this since our version was released.

Has this been fixed, or if not, is there any way to work around this error?

Hi Aaron,

Thanks for getting in touch! Sorry that you have run into a bug with an API call.

I have successfully replicated the error on my internal test environment (running 3.17.0) so you are correct that it hasn’t been resolved in a newer version. I have raised GitHub issue 3811 for this, which you can follow to be notified when it is included in a production release. As this appears to be a relatively minor fix I would expect it to be included in a point release in the next day or two.

While I would highly recommend updating to the latest version when the fix has been patched, as a workaround you could execute the updated SQL command directly against the database if required

SELECT COUNT(*) FROM dbo.[ServerTask] WHERE ([State] in ('Canceled', 'Failed', 'Success', 'TimedOut', 'Queued'))

I hope that helps,

Regards,

Alex

Hi Aaron,

Just wanted to let you now that Octopus 3.17.2 was released today and included the fix for Issue 3811. I would be very interested to confirm that this has resolved your issue, please let me know how you go after the upgrade!

I look forward to hearing from you,

Regards
Alex

Excellent, thanks!

I’ll let you know once we’ve updated and tested.

  • Aaron Walker

Hi.

We’ve updated our Octopus install and the problem has been resolved. We are now able to filter tasks from the REST API successfully.

Thanks!

  • Aaron Walker

From: “Walker, Aaron [Identifix]” Aaron.Walker@identifix.com
Date: Friday, September 22, 2017 at 9:37 AM
To: Alex Rolley tender2+da9e7774b6@tenderapp.com
Subject: Re: Re: Tasks API- Syntax Error Excluding Running Tasks [Problems #58777]

Excellent, thanks!

I’ll let you know once we’ve updated and tested.

  • Aaron Walker

Hi Aaron,

Thanks for the update, glad to hear that the issue is resolved!

Happy deploying,

Regards,

Alex