504 Gateway Timeout

My company has a webapp for customers where they can integrate with Infusionsoft.

For a small number of customers, any request to either the legacy xml-rpc or rest api is returning a 504 Gateway Timeout.
The same requests for other customers are successful.

Is there a chance that my customers have canceled their infusionsoft accounts and this is the response from mashery not receiving a response from infusionsoft api’s?

Also note that the oauth token refresh is successful for all customers.

Yes, since we front our services with Mashery, if an access token is still valid it will make it past the external proxy, but fail to be routed to a live application instance if they have cancelled and the instance was removed.

The issue i’m seeing is that the api calls for specific customers always return a 504 for any api call (legacy or rest) but the access token continues to refresh.

Any suggestions why the auth would continue to work but the api calls consistently fail with a 504 response?

Tokens aren’t directly related to a particular user’s payment status, and since we proxy through Mashery we don’t handle the refresh on our side.

You’ll need to trap 504 exceptions and handle them in an appropriate manner, most likely by invalidating them if they continue to fail in your database so that you don’t consume your API call quota by making requests that will never succeed.

I would add that getting the response headers and response bodies of these requests will be helpful.

I’m suspecting that the calls you’re making might have a significant influence here? For example, if you’re pulling saved searches, you’ll get a 504 in some cases where the report is too complex of a query. What are the calls you’re using for this interface?

The 504 response happens for all api calls, rest or xml, regardless of possible server side complexity.

----------------------------- Captured stdout call -----------------------------
send: "POST /crm/xmlrpc/v1?access_token=<access_token> HTTP/1.1\r\nHost: api.infusionsoft.com\r\nAccept-Encoding: gzip\r\nUser-Agent: xmlrpclib.py/1.0.1 (by www.pythonware.com)\r\nContent-Type: text/xml\r\nContent-Length: 517\r\n\r\n<?xml version='1.0'?>\n<methodCall>\n<methodName>DataService.query</methodName>\n<params>\n<param>\n<value><string>_removed_</string></value>\n</param>\n<param>\n<value><string>User</string></value>\n</param>\n<param>\n<value><int>100</int></value>\n</param>\n<param>\n<value><int>0</int></value>\n</param>\n<param>\n<value><struct>\n</struct></value>\n</param>\n<param>\n<value><array><data>\n<value><string>Id</string></value>\n<value><string>Email</string></value>\n</data></array></value>\n</param>\n</params>\n</methodCall>\n"
reply: 'HTTP/1.1 504 Gateway Timeout\r\n'
header: Content-Type: text/xml
header: Date: Mon, 29 Apr 2019 12:23:18 GMT
header: Server: Mashery Proxy
header: X-Mashery-Error-Code: ERR_504_GATEWAY_TIMEOUT
header: X-Mashery-Message-ID: 1e967625-1a13-4ab9-8f13-1c9ea679e167
header: X-Mashery-Responder: prod-j-worker-us-west-1c-19.mashery.com
header: X-PackageKey-QPS-Allotted: 50
header: X-PackageKey-QPS-Current: 1
header: X-PackageKey-Quota-Allotted: 500000
header: X-PackageKey-Quota-Current: 36284
header: X-Plan-Quota-Reset: Tuesday, April 30, 2019 12:00:00 AM GMT
header: Content-Length: 24
header: Connection: keep-alive

I see Python is involved and it looks like a call related to Users?

It’s getting stopped at the authentication server but the server is reporting incorrect information back to you (like QPS-Allotted should be 25 and Quota-Allotted should be 125000). So it would be something that you would need to contact IS for to look into the mashery logs to track down.