Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Job Role does not consider the 207 multi-status response #176

Closed
rj93 opened this issue Jul 7, 2022 · 0 comments · Fixed by #182
Closed

Update Job Role does not consider the 207 multi-status response #176

rj93 opened this issue Jul 7, 2022 · 0 comments · Fixed by #182
Assignees
Labels
bug Something isn't working

Comments

@rj93
Copy link
Contributor

rj93 commented Jul 7, 2022

The endpoint used to update job roles (/service-api/v2/accessgroups/function-groups/batch/update) returns a response with a 207 HTTP status with each items status contained within:

{
  "value": [
    {
      "resourceId": "8f4dbe1092054315a7300ab7c9a585ee",
      "status": "200",
      "errors": [],
      "action": "add",
      "externalServiceAgreementId": "External ID of SA-1"
    },
    {
      "resourceId": "efc1b037dbad49df9f62907ba7af2497",
      "status": "404",
      "action": "remove",
      "externalServiceAgreementId": "External ID of SA-2",
      "errors": [
        "Resource does not exist"
      ]
    }
  ]
}

Even if there is only a single item in the response and it's status is 4xx the response still uses the 207 HTTP status.

This scenario is not covered in the current implementation and results in what appears to be a successful run we no logs visble.

It is only when debug logs of the HTTP response are enabled we can see that the request has actually failed:

2022-07-07 10:48:10.620 DEBUG [,,] 55703 --- [ctor-http-nio-3] r.n.r.DefaultPooledConnectionProvider    : [052bb75d, L:/172.27.252.87:51240 - R:api-test-coutts.coutts.backbasecloud.com/52.213.142.44:443] onStateChange(PUT{uri=/access-control/service-api/v2/accessgroups/function-groups/batch/update, connection=PooledConnection{channel=[id: 0x052bb75d, L:/172.27.252.87:51240 - R:api-test-coutts.coutts.backbasecloud.com/52.213.142.44:443]}}, [response_completed])
2022-07-07 10:48:10.620 DEBUG [,,] 55703 --- [ctor-http-nio-3] r.n.r.DefaultPooledConnectionProvider    : [052bb75d, L:/172.27.252.87:51240 - R:api-test-coutts.coutts.backbasecloud.com/52.213.142.44:443] onStateChange(PUT{uri=/access-control/service-api/v2/accessgroups/function-groups/batch/update, connection=PooledConnection{channel=[id: 0x052bb75d, L:/172.27.252.87:51240 - R:api-test-coutts.coutts.backbasecloud.com/52.213.142.44:443]}}, [disconnecting])
2022-07-07 10:48:10.620 DEBUG [,,] 55703 --- [ctor-http-nio-3] r.n.r.DefaultPooledConnectionProvider    : [052bb75d, L:/172.27.252.87:51240 - R:api-test-coutts.coutts.backbasecloud.com/52.213.142.44:443] Releasing channel
2022-07-07 10:48:10.620 DEBUG [,,] 55703 --- [ctor-http-nio-3] r.n.resources.PooledConnectionProvider   : [052bb75d, L:/172.27.252.87:51240 - R:api-test-coutts.coutts.backbasecloud.com/52.213.142.44:443] Channel cleaned, now: 1 active connections, 9 inactive connections and 0 pending acquire requests.
2022-07-07 10:48:10.620 DEBUG [,,] 55703 --- [ctor-http-nio-3] reactor.netty.http.client.HttpClient     : [052bb75d, L:/172.27.252.87:51240 - R:api-test-coutts.coutts.backbasecloud.com/52.213.142.44:443] READ COMPLETE
2022-07-07 10:48:10.621 DEBUG [,,] 55703 --- [ctor-http-nio-3] reactor.netty.http.client.HttpClient     : [27f38e75-2, L:/172.27.252.87:51243 - R:api-test-coutts.coutts.backbasecloud.com/52.213.142.44:443] READ: 612B HTTP/1.1 207
Cache-Control: no-cache, no-store, max-age=0, must-revalidate
Content-Type: application/json
Date: Thu, 07 Jul 2022 09:48:10 GMT
Expires: 0
Pragma: no-cache
Strict-Transport-Security: max-age=31536000 ; includeSubDomains
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-XSS-Protection: 1; mode=block
Content-Length: 234
Connection: keep-alive

[{"additions":{},"externalServiceAgreementId":null,"action":null,"resourceId":"4028973075e667d1017618d0806b0002","status":"400","errors":["You cannot manage this entity, while the referenced service agreement has a pending change."]}]
2022-07-07 10:48:10.621 DEBUG [,,] 55703 --- [ctor-http-nio-3] r.n.http.client.HttpClientOperations     : [27f38e75-2, L:/172.27.252.87:51243 - R:api-test-coutts.coutts.backbasecloud.com/52.213.142.44:443] Received response (auto-read:false) : [Cache-Control=no-cache, no-store, max-age=0, must-revalidate, Content-Type=application/json, Date=Thu, 07 Jul 2022 09:48:10 GMT, Expires=0, Pragma=no-cache, Strict-Transport-Security=max-age=31536000 ; includeSubDomains, X-Content-Type-Options=nosniff, X-Frame-Options=DENY, X-XSS-Protection=1; mode=block, Connection=keep-alive, content-length=234]
2022-07-07 10:48:10.621 DEBUG [,,] 55703 --- [ctor-http-nio-3] r.n.r.DefaultPooledConnectionProvider    : [27f38e75-2, L:/172.27.252.87:51243 - R:api-test-coutts.coutts.backbasecloud.com/52.213.142.44:443] onStateChange(PUT{uri=/access-control/service-api/v2/accessgroups/function-groups/batch/update, connection=PooledConnection{channel=[id: 0x27f38e75, L:/172.27.252.87:51243 - R:api-test-coutts.coutts.backbasecloud.com/52.213.142.44:443]}}, [response_received])
2022-07-07 10:48:10.621 TRACE [,,] 55703 --- [ctor-http-nio-3] o.s.w.r.f.client.ExchangeFunctions       : [5a387038] [27f38e75-2, L:/172.27.252.87:51243 - R:api-test-coutts.coutts.backbasecloud.com/52.213.142.44:443] Response 207 MULTI_STATUS, headers={masked}
2022-07-07 10:48:10.621 TRACE [,,] 55703 --- [ctor-http-nio-3] .s.c.s.i.w.c.TraceExchangeFilterFunction : OnNext
2022-07-07 10:48:10.621 TRACE [,,] 55703 --- [ctor-http-nio-3] o.s.c.s.i.reactor.ReactorSleuth          : Spring context [org.springframework.context.annotation.AnnotationConfigApplicationContext@523d6bdb, started on Thu Jul 07 10:47:56 BST 2022], Reactor context [Context0{}], name [map]
2022-07-07 10:48:10.621 TRACE [,,] 55703 --- [ctor-http-nio-3] o.s.c.s.i.reactor.ReactorSleuth          : Spring context [org.springframework.context.annotation.AnnotationConfigApplicationContext@523d6bdb, started on Thu Jul 07 10:47:56 BST 2022], Reactor context [Context0{}], name [peek]
2022-07-07 10:48:10.621 DEBUG [,,] 55703 --- [ctor-http-nio-3] reactor.netty.channel.FluxReceive        : [27f38e75-2, L:/172.27.252.87:51243 - R:api-test-coutts.coutts.backbasecloud.com/52.213.142.44:443] FluxReceive{pending=0, cancelled=false, inboundDone=false, inboundError=null}: subscribing inbound receiver
2022-07-07 10:48:10.621 TRACE [,,] 55703 --- [ctor-http-nio-3] .s.c.s.i.w.c.TraceExchangeFilterFunction : OnNext finally
2022-07-07 10:48:10.621 TRACE [,,] 55703 --- [ctor-http-nio-3] .s.c.s.i.w.c.TraceExchangeFilterFunction : OnComplete
2022-07-07 10:48:10.622 DEBUG [,,] 55703 --- [ctor-http-nio-3] r.n.http.client.HttpClientOperations     : [27f38e75-2, L:/172.27.252.87:51243 - R:api-test-coutts.coutts.backbasecloud.com/52.213.142.44:443] Received last HTTP packet
2022-07-07 10:48:10.622 TRACE [,,] 55703 --- [ctor-http-nio-3] o.s.http.codec.json.Jackson2JsonDecoder  : [5a387038] [27f38e75-2, L:/172.27.252.87:51243 - R:api-test-coutts.coutts.backbasecloud.com/52.213.142.44:443] Decoded [class BatchResponseItemExtended {
    additions: {}
    externalServiceAgreementId: null
    action: null
    resourceId: 4028973075e667d1017618d0806b0002
    status: 400
    errors: [You cannot manage this entity, while the referenced service agreement has a pending change.]
}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
2 participants