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
/products?skus=1,2,3 – returns a much smaller subset of products
HYPOTHESIS: The response from /products is too big for smartDocs to handle
DETAILS:
Action 1: start Trace and call /products from smartDocs
Observation 1:
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:
GET https://apiconsole-prod.apigee.net/smartdocs/v1/sendrequest?targeturl={my-target-url} 502 (Bad Gateway)
Bad Gateway
Uncaught TypeError: Cannot read property 'length'
Thanks!
Have you tried disabling the Prism syntax highlighter from SmartDocs configuration? For large responses the library sometimes fails.
Or it could be the ajax request times out.
you able to figure out the reason? I am seeing the same issue
getting same error, @Michael Haggerty where you able to find the root cause for this issue. Thanks
This issue was resolved after correcting the smardocs endpoint url.
/sendRequest suffix was missing in smartdocs endpoint url in developer portal
@potturiprasanth to be more precise this should be /sendrequest (small "r")
User | Count |
---|---|
3 | |
2 | |
1 | |
1 | |
1 |