question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ActivityLogs DefineQuery Bad Request

See original GitHub issue
var log = await Repo.ActivityLogs
                .DefineQuery()
                .StartingFrom(DateTime.Now.AddDays(-7))
                .EndsBefore(DateTime.Now)
                .WithAllPropertiesInResponse()
                .FilterByResource(id)
               .ExecuteAsync();

Operation returned an invalid status code ‘BadRequest’ Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: Microsoft.Azure.Management.Monitor.Fluent.Models.ErrorResponseException: Operation returned an invalid status code ‘BadRequest’

[ErrorResponseException: Operation returned an invalid status code 'BadRequest']
   Microsoft.Azure.Management.Monitor.Fluent.<ListWithHttpMessagesAsync>d__5.MoveNext() +4302
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +31
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +60
   Microsoft.Azure.Management.Monitor.Fluent.<ListAsync>d__0.MoveNext() +354
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +31
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +60
   Microsoft.Azure.Management.Monitor.Fluent.<<ListEventDataAsync>b__0>d.MoveNext() +288
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +31
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +60
   Microsoft.Azure.Management.ResourceManager.Fluent.Core.<LoadPageWithWrapModelAsync>d__16.MoveNext() +376
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +31
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +60
   Microsoft.Azure.Management.ResourceManager.Fluent.Core.<LoadPage>d__15.MoveNext() +434
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +31
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +60
   Microsoft.Azure.Management.Monitor.Fluent.<ListEventDataAsync>d__10.MoveNext() +476
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +31
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +60
   Microsoft.Azure.Management.Monitor.Fluent.<ExecuteAsync>d__16.MoveNext() +456
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +31
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +60
   Microsoft.Azure.Management.Monitor.Fluent.<Microsoft-Azure-Management-Monitor-Fluent-IWithActivityLogsQueryExecute-ExecuteAsync>d__35.MoveNext() +198
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +31
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +60
   System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +31
   .Monitoring.<QueryAzure>d__4.MoveNext() in AzureActivityLogService.cs:109
   System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw() +31
   System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) +60
   System.Runtime.CompilerServices.TaskAwaiter`1.GetResult() +31
   PppLearning.DevOps.MSAzure.Monitoring.<GetLogs>d__3.MoveNext() in AzureActivityLogService.cs:34
  • Using v1.16.1 Fluent Nuget Packages
  • ASP.net 4.7.2

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:8 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
pppchriscommented, Nov 1, 2018

@hovsepm - found the problem. I am in AEST timezone. If I change the timestamp to be UTC now it works without an issue.

var log = await Repo.ActivityLogs .DefineQuery() .StartingFrom(DateTime.Now.AddDays(-1).ToUniversalTime()) .EndsBefore(DateTime.Now.ToUniversalTime()) .WithAllPropertiesInResponse() .FilterByResource(id) .ExecuteAsync();

1reaction
hovsepmcommented, Nov 2, 2018

I will keep this issue open for some time until back-end service team will provide better error messages 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

I get Bad Request every time i try to create an azure function
Today, I try to create an azure function instance but, everytime I try to create one I get a Bad Request Error
Read more >
Log Analytics Error 400 Bad Request
Solved: I'm using the export to Power BI (M query) functionality thorugh azure log analytics. The dashboard was working since a week ago,...
Read more >
API defender for endpoint bad request - Microsoft Q&A
I am trying advanced hunting queries towards the endpoint "[https://api-eu.securitycenter.microsoft.com/api/advancedqueries/run".
Read more >
Response status code does not indicate success: 400 (Bad ...
A 400 is a client error which usually means the request is malformed. 400 in particular means that the request could not be...
Read more >
Bad request
Cause. Adyen APIs return this error when: The request is malformed or is not in the expected format. Solution. Check the syntax and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found