Node.js https response truncated from Apigee proxied API

Hi,

This is more of a Node.js question and an issue with the core https module that only seems to occur when accessing my API through the Apigee proxy. It seems to be an issue with the http/https module firing the .on('end') event too soon.

API requests through the Apigee proxy using Node.js and the the core https return a truncated JSON response for certain API methods. By switching to the http module for the request, it seems to resolve the issue.

For example:

GET https://my-proxy.apigee.net/v1/myapi (example only)

When accessed via the browser search bar, it works just fine. However, if used in a server-side request via Node.js and the https module, the JSON results are truncated (partially there, just not complete). If I switch to http, it works just fine.

Please note that this isn't an issue of making a request to an http resource via Node's https module and vice versa, which will generate a run time error.

Seems like more of a Node issue than any issues with the Apigee proxy. Any ideas? Could it be an SSL cert issue causing this?

Thanks

0 3 1,144
3 REPLIES 3

Hi Dywayne, can you show us the node code that is causing the issue?

Hi Mike, it is most-likely an issue with my server-side API facade that I'm using to securely tack on my apikey to my requests to the Apigee proxy. I tried to post some code earlier, but i couldn't seem to format it, so I didn't want to force anyone to try to decipher it. One issue I noticed that could be part of the problem is that my Apigee proxy was using the "Add CORs" policy and I was also adding the same access control headers from my API endpoint as well. The OPTIONS request's response would display duplicate entries in the response header for access-control-allow-headers and methods. The browser (Chrome) didn't seem to like this and this caused the API request through my proxy to not make the following GET request after making the OPTIONS request. Let me see if I can put together a small code sample that might provide a reproducible error. Thanks 🙂

@Dywayne Johnson Did you try inserting "code" using wysiwyg? If it fails, you could try attaching a doc with with the code.