Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

smartDocs: Uncaught TypeError: Cannot read property 'length'

Not applicable

OVERVIEW:

My apigee proxy works when I call it from postman, but when I call it from smartDocs the browser window shows “An internal error has occurred. Please retry your request.” Chrome developer console says the root cause is 502 bad gateway > Uncaught TypeError: Cannot read property 'length'

/products - returns all products, size = 13.61 MB, response takes 24 sec

  • Call works from postman
  • Call fails from smartDocs - but Trace shows http.status = 200

/products?skus=1,2,3 – returns a much smaller subset of products

  • Call works from postman
  • Call works from smartDocs


HYPOTHESIS: The response from /products is too big for smartDocs to handle


DETAILS:

Action 1: start Trace and call /products from smartDocs

Observation 1:

  • Trace shows http.status = 200
  • Chrome developer console shows a CORS error

XMLHttpRequest cannot load https://apiconsole-prod.apigee.net/smartdocs/v1/sendrequest?targeturl={my-target-url}. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://dev-{my-org}.devportal.apigee.com' is therefore not allowed access. The response had HTTP status code 502.

Action 2: Enable CORS with chrome plugin (NOTE: The other calls worked without enabling the CORS plugin)

Observation 2:

  • Chrome developer console shows a 502 Bad Gateway Error

GET https://apiconsole-prod.apigee.net/smartdocs/v1/sendrequest?targeturl={my-target-url} 502 (Bad Gateway)

Bad Gateway

Uncaught TypeError: Cannot read property 'length'

  • The response being sent from the proxy has a non-null content-length header

Thanks!

0 5 474
5 REPLIES 5
Top Solution Authors