{ Community }
  • Academy
  • Docs
  • Developers
  • Resources
    • Community Articles
    • Apigee on GitHub
    • Code Samples
    • Videos & eBooks
    • Accelerator Methodology
  • Support
  • Ask a Question
  • Spaces
    • Product Announcements
    • General
    • Edge/API Management
    • Developer Portal (Drupal-based)
    • Developer Portal (Integrated)
    • API Design
    • APIM on Istio
    • Extensions
    • Business of APIs
    • Academy/Certification
    • Adapter for Envoy
    • Analytics
    • Events
    • Hybrid
    • Integration (AWS, PCF, Etc.)
    • Microgateway
    • Monetization
    • Private Cloud Deployment
    • 日本語コミュニティ
    • Insights
    • IoT Apigee Link
    • BaaS/Usergrid
    • BaaS Transition/Migration
    • Apigee-127
    • New Customers
    • Topics
    • Questions
    • Articles
    • Ideas
    • Leaderboard
    • Badges
  • Log in
  • Sign up

Get answers, ideas, and support from the Apigee Community

  • Home /
  • Edge/API Management /
avatar image
0
Question by Neetu Garg · May 18, 2017 at 07:31 AM · 298 Views api proxyservice callouterror handlinghttp error codes

ServiceCallout status code is populating as null for timeout or connection refused errors

Hi Team,

I am working on fault handling for the service callout policy. However, the testResponse.status.code or testResponse.error.code is getting populated as null in case of connection timed out error.

In service callout policy , I have given the response variable name as "testResponse"

Shouldnt it populate as 504 ?

Response Body :

Execution of ServiceCallout ServiceCallOut_TestPolicy failed. Reason: timeout occurred ServiceCallOut_TestPolicy
Comment
Add comment Show 2
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Popleys · Feb 07, 2020 at 04:37 AM 0
Link

Hi Apigee team,

could you pls comment on this, since I am also getting null rather 5xx/503/502 while connection-time-out and read-time out, during service callout?

avatar image Jayesh Upadhyay · Feb 07, 2020 at 09:28 AM 0
Link

@Neetu Garg

You must be checking testResponse.status.code as part of <FaultRules> execution.

Can you try implementing <DefaultFaultRule> to see if you get required information.

https://docs.apigee.com/api-platform/fundamentals/fault-handling#creatingfaultrules-creatingadefaultfaultrule

Close

2 Answers

  • Sort: 
avatar image
0

Answer by Dino-at-Google   · Feb 07, 2020 at 01:39 PM

No, it shouldn't populate as 504.

This is an old question, but I guess still relevant.

The 504 status code is a real status code that gets returned by a real target system. ServiceCallout is not a system, it's a policy. If the SC policy does not connect, there is no target system that can possibly return a 500 or 504 or anything. There's no connection. So the SC provides you a response that has those properties set as null, or empty, or undefined (As you like).

It is possible for the response populated by ServiceCallout to contain 500 or 503 or 504, (etc). Those all happen when a connection is made to *something*. The 504 in particular will happen when the SC actually connects to an intermediate gateway which affirmatively responds with 504, because THAT GATEWAY cannot connect to its upstream.

When the SC fails to connect directly to the upstream (and there is no intermediate gateway), this results in no status code. When the SC connects to an intermediate gateway which itself fails to connect to the upstream, the SC receives a 504.

If you want your API Proxy to return a 504 in the condition that it fails to connect directly, then you can use a Condition and a RaiseFault to implement that behavior. But that decision should not be taken within the ServiceCallout policy itself.

Comment
Add comment Show 1 · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Popleys · Feb 07, 2020 at 01:45 PM 0
Link

In regards to this,at least the SC should populate with some exit codes/reason error codes may be between (1 to 5). This way we would understand the issue is with connection,read-timeout,backendSSLcertExpiredIssue etc.

avatar image
0

Answer by Priyadarshi Ajitav Jena · Oct 03, 2020 at 10:36 AM

you can add your custom error code. As this is a policy fail, you should not get a backend error code.

Comment
Add comment · Link
10 |5000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by Apigeeks only
  • Viewable by the original poster
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Follow this Question

Answers Answers and Comments

64 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

lookup cache is not working as expected 1 Answer

Aggregating Raise Fault policies in a single Service Callout policy 1 Answer

How to handle non-200 status codes from hosted targets? 1 Answer

How to capture 413 error in Apigee? 4 Answers

Set Multiple headers in Javascript httpclient 1 Answer

  • Products
    • Edge - APIs
    • Insights - Big Data
    • Plans
  • Developers
    • Overview
    • Documentation
  • Resources
    • Overview
    • Blog
    • Apigee Institute
    • Academy
    • Documentation
  • Company
    • Overview
    • Press
    • Customers
    • Partners
    • Team
    • Events
    • Careers
    • Contact Us
  • Support
    • Support Overview
    • Documentation
    • Status
    • Edge Support Portal
    • Privacy Policy
    • Terms & Conditions
© 2021 Apigee Corp. All rights reserved. - Apigee Community Terms of Use - Powered by AnswerHub
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Create an article
  • Post an idea
  • Spaces
  • Product Announcements
  • General
  • Edge/API Management
  • Developer Portal (Drupal-based)
  • Developer Portal (Integrated)
  • API Design
  • APIM on Istio
  • Extensions
  • Business of APIs
  • Academy/Certification
  • Adapter for Envoy
  • Analytics
  • Events
  • Hybrid
  • Integration (AWS, PCF, Etc.)
  • Microgateway
  • Monetization
  • Private Cloud Deployment
  • 日本語コミュニティ
  • Insights
  • IoT Apigee Link
  • BaaS/Usergrid
  • BaaS Transition/Migration
  • Apigee-127
  • New Customers
  • Explore
  • Topics
  • Questions
  • Articles
  • Ideas
  • Badges