cloudfoundry / app-autoscaler-cli-plugin

CF CLI Plugin for the App AutoScaler
Apache License 2.0
10 stars 12 forks source link

Receive "Error: invalid character 'C' looking for beginning value" #20

Closed kansberry closed 2 years ago

kansberry commented 5 years ago

After installing the 1.0.0.1 plugin and setting the autoscaling-api to "https://appscalerapi.cf.test.domain.com:6100" we successfully set a policy using the "cf aasp" command and this works, scaling our application as defined in the policy we uploaded. However, when executing "cf asm" or "cf ash" we receive the output of "Error: invalid character 'C' looking for beginning value".

We installed "https://github.com/cloudfoundry-incubator/app-autoscaler-release/tree/475d3bd134a4a0f089a13fac6a1fcb4829cca630", which is assoicated with the current last commit of this repository.

cdlliuy commented 5 years ago

@kansberry , could you enable CF_TRACE=true and paste the output here for further investigation? Thanks a lot !

kansberry commented 5 years ago

In the process of redeployment my environment. Will get you this when setup is complete.

kansberry commented 5 years ago

For the "cf ash", here is the bottom of the trace information:

REQUEST: [2018-12-21T15:47:21Z] GET /health HTTP/1.1 Host: autoscaler-api.cf.test.example.com:6100

RESPONSE: [2018-12-21T15:47:21Z] Elapsed: 42ms HTTP/1.1 200 OK Connection: close Content-Length: 21 Cache-Control: no-store, no-cache, must-revalidate, proxy-revalidate Content-Security-Policy: default-src 'self'; script-src 'self' Content-Type: application/json; charset=utf-8 Date: Fri, 21 Dec 2018 15:47:21 GMT Etag: W/"15-XbzQRZr2To3n37QCNzXOUA" Expires: 0 Pragma: no-cache Strict-Transport-Security: max-age=15552000; includeSubDomains Surrogate-Control: no-store X-Content-Type-Options: nosniff X-Dns-Prefetch-Control: off X-Download-Options: noopen X-Frame-Options: SAMEORIGIN X-Xss-Protection: 1; mode=block

{"uptime":173483.789}

REQUEST: [2018-12-21T15:47:21Z] GET /v1/apps/a5c13e0a-af80-4557-9141-b181ce9574f2/scaling_histories?end-time=1545407241445668154&order=asc&page=1 HTTP/1.1 Host: autoscaler-api.cf.test.example.com:6100 Authorization: [PRIVATE DATA HIDDEN]

RESPONSE: [2018-12-21T15:47:22Z] Elapsed: 20ms HTTP/1.1 404 Not Found Connection: close Content-Length: 129 Cache-Control: no-store, no-cache, must-revalidate, proxy-revalidate Content-Security-Policy: default-src 'self'; script-src 'self' Content-Type: text/html; charset=utf-8 Date: Fri, 21 Dec 2018 15:47:22 GMT Expires: 0 Pragma: no-cache Strict-Transport-Security: max-age=15552000; includeSubDomains Surrogate-Control: no-store X-Content-Type-Options: nosniff X-Dns-Prefetch-Control: off X-Download-Options: noopen X-Frame-Options: SAMEORIGIN X-Xss-Protection: 1; mode=block

Cannot GET /v1/apps/a5c13e0a-af80-4557-9141-b181ce9574f2/scaling_histories?end-time=1545407241445668154&order=asc&page=1

FAILED

Error: invalid character 'C' looking for beginning of value

cdlliuy commented 5 years ago

@kansberry , sorry for the inconvenience. we will enhance the cli implementation to include the handling of 404.
Also, I wonder why it would get a 404 not found response from the autoscaler APIs. According to the design, the expected response should be 200 OK when no result hinted, like below example:

REQUEST: [2018-12-24T17:01:11+08:00]
GET /v1/apps/96b79bff-6c55-4bb3-a809-03831033f188/scaling_histories?end-time=1545378441000000000&order=asc&page=1 HTTP/1.1
Host: autoscaler.xxxxxx
Authorization: [PRIVATE DATA HIDDEN]

RESPONSE: [2018-12-24T17:01:12+08:00] Elapsed: 1405ms
HTTP/1.1 200 OK
Connection: close
Content-Length: 91
Cache-Control: no-store, no-cache, must-revalidate, proxy-revalidate
Content-Security-Policy: default-src 'self'; script-src 'self'
Content-Type: application/json; charset=utf-8
Date: Mon, 24 Dec 2018 09:01:12 GMT
Etag: W/"5b-uoa3dEFSOvbD74wmbsBX0Q"
Expires: 0
Pragma: no-cache
Strict-Transport-Security: max-age=15552000; includeSubDomains
Surrogate-Control: no-store
X-Content-Type-Options: nosniff
X-Dns-Prefetch-Control: off
X-Download-Options: noopen
X-Frame-Options: SAMEORIGIN
X-Vcap-Request-Id: f1d44dbe-12d3-454f-60ac-1659600c757e
X-Xss-Protection: 1; mode=block

{"total_results":0,"total_pages":0,"page":1,"prev_url":null,"next_url":null,"resources":[]}
OK

No history found for app testapp2.

Could you share with us what is the app-autoscaler version (commit) of your deployment?

kansberry commented 5 years ago

We are using the release found here:

https://bosh.io/d/github.com/cloudfoundry-incubator/app-autoscaler-release?v=1.0.0

cdlliuy commented 5 years ago

@kansberry , sorry, I still can't reproduce the 404 issue on v1.0.0 even after I deleted all my previous deployment and rebuild from scratch. I created a pull request to fix the error handling process in CLI part. #27 . With this PR, you won't see unmarshal failure anymore. The original 404 error will be displayed.

Anyway, I think you don't expect 404 as well ... could you help to launch "bosh releases | grep autoscaler" to confirm the commit again?