# Bubble API connector - Processing HTTP Error / Status Codes

**URL:** <https://forum.bubble.io/t/bubble-api-connector-processing-http-error-status-codes/5685>\
**Category:** Need help\
**Created:** [September 2, 2016, 2:57pm UTC](https://forum.bubble.io/t/bubble-api-connector-processing-http-error-status-codes/5685 "2016-09-02T14:57:06Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![madras](https://avatars.discourse-cdn.com/v4/letter/m/85f322/32.png) [@madras](https://forum.bubble.io/u/madras)\
**Post date:** [September 2, 2016, 2:57pm UTC](https://forum.bubble.io/t/bubble-api-connector-processing-http-error-status-codes/5685/1 "2016-09-02T14:57:06Z")

</div>

The bubble API connector is great for “Sunny” day cenarios. It can connect to just about any external service.

Now, I’m now running into some limitations with “Rainy” day scenarios.

Continuing the discussion from [[Feature Request] Error in Logs, or let us manage errors responses](http://forum.bubble.io/t/feature-request-error-in-logs-or-let-us-manage-errors-responses/2011/3):

Like the post above, I want to able to write some logic and workflows based on the HTTP error codes returned.

![](https://us1.discourse-cdn.com/bubble/original/2X/2/20d147bbcaf56e983937d639b3fa5a46f77c75c0.PNG)

In the example, above I want to ask the user to enter the address again if I get an HTTP error code 422, and so on.

Has anyone found a way to do this - process the error code from the bubble API connector?

@emmanuel - Is there any workaround we can use? If not, is this on the product roadmap? Ability to handle “Rainy” day scenarios - as the complexity and maturity of bubble applications increases, this need also increases.

---

<div class="post-metadata">

**Author:** ![emmanuel](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/emmanuel/32/27657_2.png) [@emmanuel](https://forum.bubble.io/u/emmanuel)\
**Post date:** [September 2, 2016, 6:33pm UTC](https://forum.bubble.io/t/bubble-api-connector-processing-http-error-status-codes/5685/2 "2016-09-02T18:33:28Z")

</div>

No immediate plan, but we’ll think about it. I think a few other things regarding the API connector will come first (like Oauth, if possible), but eventually we should have an answer there as well. I can’t commit on a timeline though.

---

<div class="post-metadata">

**Author:** ![madras](https://avatars.discourse-cdn.com/v4/letter/m/85f322/32.png) [@madras](https://forum.bubble.io/u/madras)\
**Post date:** [September 5, 2016, 2:14pm UTC](https://forum.bubble.io/t/bubble-api-connector-processing-http-error-status-codes/5685/3 "2016-09-05T14:14:16Z")

</div>

Agree. OAuth would be a very welcome feature indeed !.

On this topic, and without knowing how bubble platform is set up - is there a possibility to expand

> [@\[New Feature\] Custom error handlers for elements](http://forum.bubble.io/t/new-feature-custom-error-handlers-for-elements/4368):
>
> We’ve added a new event type, “An element had an error running a workflow”. As you probably know, when an error happens in a user-interaction-initiated workflow (clicking a button, changing an input, etc), we pop up an alert with the error message. This isn’t always the greatest user experience. Sometimes you might want to give the user the option to retry, take them back to a previous page, show a link to ask for help, etc. Or maybe you want to show the same error message, but show it in a …

to cover the use case I’m describing?

---

<div class="post-metadata">

**Author:** ![emmanuel](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/emmanuel/32/27657_2.png) [@emmanuel](https://forum.bubble.io/u/emmanuel)\
**Post date:** [September 6, 2016, 9:53pm UTC](https://forum.bubble.io/t/bubble-api-connector-processing-http-error-status-codes/5685/4 "2016-09-06T21:53:20Z")

</div>

Not immediately, it’s a very different part of code. We’ll think about it though.

---

<div class="post-metadata">

**Author:** ![supernaturally](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/supernaturally/32/8307_2.png) [@supernaturally](https://forum.bubble.io/u/supernaturally)\
**Post date:** [February 24, 2017, 12:53am UTC](https://forum.bubble.io/t/bubble-api-connector-processing-http-error-status-codes/5685/5 "2017-02-24T00:53:25Z")

</div>

Any update on this? I noticed that using SendGrid from the API Connector, there is currently no way to store the Status Code value (i.e. there is no way to determine if the email was actually accepted by sendgrid).

Is there any solution to this in the meantime? For booking platforms, this is critical.

---

<div class="post-metadata">

**Author:** ![AliFarahat](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/alifarahat/32/189604_2.png) [@AliFarahat](https://forum.bubble.io/u/AliFarahat)\
**Post date:** [April 16, 2018, 10:06pm UTC](https://forum.bubble.io/t/bubble-api-connector-processing-http-error-status-codes/5685/6 "2018-04-16T22:06:45Z")

</div>

I have to follow-up on this @emmanuel I have a plugin for a customer that is impossible to know in the editor that an error has been encountered. In the logs it clearly shows Raw error but in the workflows there is no way to test this against.

Exposing the status codes will be extremely beneficial to everyone.

---

<div class="post-metadata">

**Author:** ![reger-alexander](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/reger-alexander/32/22827_2.png) [@reger-alexander](https://forum.bubble.io/u/reger-alexander)\
**Post date:** [April 17, 2018, 9:41am UTC](https://forum.bubble.io/t/bubble-api-connector-processing-http-error-status-codes/5685/7 "2018-04-17T09:41:30Z")

</div>

+1 on this, very crucial!!

---

<div class="post-metadata">

**Author:** ![mebeingken](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/mebeingken/32/20139_2.png) [@mebeingken](https://forum.bubble.io/u/mebeingken)\
**Post date:** [May 10, 2018, 3:20pm UTC](https://forum.bubble.io/t/bubble-api-connector-processing-http-error-status-codes/5685/8 "2018-05-10T15:20:42Z")

</div>

+1 for api connector status code access. My use case is to process information from Clearbit. Status code is the only way to know if a second attempt to pull data should be performed…and since the fee for the service is per api request, I’d prefer not to double up.

RESPONSE TYPES  
Code Description  
200 Successful lookup, person encoded in the response body.  
202 Asynchronously looking up the person.  
404 Person not found.

EDIT: Clearbit actually allows for a webhook, so there is a way around this for me.

---

<div class="post-metadata">

**Author:** ![AliFarahat](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/alifarahat/32/189604_2.png) [@AliFarahat](https://forum.bubble.io/u/AliFarahat)\
**Post date:** [May 10, 2018, 8:00pm UTC](https://forum.bubble.io/t/bubble-api-connector-processing-http-error-status-codes/5685/9 "2018-05-10T20:00:01Z")

</div>

Yes please. Come on Bubble team do your magic!!!

---

<div class="post-metadata">

**Author:** ![codkod](https://avatars.discourse-cdn.com/v4/letter/c/77aa72/32.png) [@codkod](https://forum.bubble.io/u/codkod)\
**Post date:** [April 16, 2019, 10:11pm UTC](https://forum.bubble.io/t/bubble-api-connector-processing-http-error-status-codes/5685/10 "2019-04-16T22:11:43Z")

</div>

there has been an update on this topic?

---

<div class="post-metadata">

**Author:** ![joel.milne](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/joel.milne/32/40485_2.png) [@joel.milne](https://forum.bubble.io/u/joel.milne)\
**Post date:** [May 10, 2019, 1:28am UTC](https://forum.bubble.io/t/bubble-api-connector-processing-http-error-status-codes/5685/11 "2019-05-10T01:28:47Z")

</div>

It is pretty standard in REST API design that 400 codes are valid responses (e.g. not found). Not being able to handle these responses properly is a pretty significant design flaw in the API Connector.

As a workaround I wrote a simple Azure Function (node.js) to wrap API calls and always return 200 with the actual code in the response body. Seems to solve the issue. Bubble could easily implement something like this this.

Here is the Azure function code in case anyone else is blocked by this as well. Just call the Azure function http endpoint with the path /bubble/your\_api\_path.

index.js:

```
const BASE_URL = '<YOUR API BASE URL>';
module.exports = async (context) => {
    
    //create a response conforming to JSend format - https://github.com/omniti-labs/jsend
    const respond = (code, message, data) => {
        context.res = { 
            headers: { 'Content-Type': 'application/json' },
            status: 200, 
            body: {
                code: code, 
                status: (code < 400) ? 'success' : (code < 500) ? 'fail' : 'error', 
                message: message, 
                data: data
            }
        };     
    }

    const options = {
        method: context.req.method,
        uri: BASE_URL + context.req.params.segments,
        headers: {
            'content-type': 'application/json',
            'x-authapi-client': context.req.headers['x-authapi-client'] <--THIS IS SPECIFIC TO MY API
        },
        qs: context.req.query,
        body: context.req.body,
        json: true,
        resolveWithFullResponse: true,
        simple: false
    }
    const request = require('request-promise-native');
    try {
        const response = await request(options); 
        //NOTE: change the respond params based on your API response format
        respond(response.statusCode, response.body.message, response.body.data); 
    } catch (e) {
        let msg = ('message' in e) ? e.message : ('cause' in e) ? e.cause : 'unknown';
        respond(500, msg, null);
    }    
}

```

function.json:

```
{
  "bindings": [{
    "authLevel" : "anonymous",
    "type" : "httpTrigger",
    "direction" : "in",
    "name" : "req",
    "route" : "bubble/{*segments}"
  }, {
    "type" : "http",
    "direction" : "out",
    "name" : "res"
  }]
}

```

host.json:

```
{
    "version": "2.0",
     "extensions": {
         "http": {
             "routePrefix": ""
         }    
    }
}
```

---

<div class="post-metadata">

**Author:** ![simon](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/simon/32/8895_2.png) [@simon](https://forum.bubble.io/u/simon)\
**Post date:** [October 15, 2019, 7:15pm UTC](https://forum.bubble.io/t/bubble-api-connector-processing-http-error-status-codes/5685/12 "2019-10-15T19:15:50Z")

</div>

Any update on this? It limits what you can do with the API connector without capturing the error codes

---

<div class="post-metadata">

**Author:** ![rosshelton](https://avatars.discourse-cdn.com/v4/letter/r/6a8cbe/32.png) [@rosshelton](https://forum.bubble.io/u/rosshelton)\
**Post date:** [January 31, 2020, 12:02am UTC](https://forum.bubble.io/t/bubble-api-connector-processing-http-error-status-codes/5685/13 "2020-01-31T00:02:13Z")

</div>

Has anyone found a way to capture error codes?

---

<div class="post-metadata">

**Author:** ![Jici](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/jici/32/30722_2.png) [@Jici](https://forum.bubble.io/u/Jici)\
**Post date:** [January 31, 2020, 12:04am UTC](https://forum.bubble.io/t/bubble-api-connector-processing-http-error-status-codes/5685/14 "2020-01-31T00:04:12Z")

</div>

Except by creating own plugin (and not use the API connector), for now it doesn’t seem that there’s a workaround with API connector.

---

<div class="post-metadata">

**Author:** ![kevin4](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/kevin4/32/59688_2.png) [@kevin4](https://forum.bubble.io/u/kevin4)\
**Post date:** [May 14, 2020, 5:44pm UTC](https://forum.bubble.io/t/bubble-api-connector-processing-http-error-status-codes/5685/15 "2020-05-14T17:44:26Z")

</div>

Another +1 on this. I need this too.

---

<div class="post-metadata">

**Author:** ![bobcardenas](https://avatars.discourse-cdn.com/v4/letter/b/3ec8ea/32.png) [@bobcardenas](https://forum.bubble.io/u/bobcardenas)\
**Post date:** [June 14, 2020, 5:37pm UTC](https://forum.bubble.io/t/bubble-api-connector-processing-http-error-status-codes/5685/16 "2020-06-14T17:37:47Z")

</div>

Another +1. We just built our first app with Bubble and ran into this. API connector is awesome except for this major gap.

---

<div class="post-metadata">

**Author:** ![Szymon](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/szymon/32/61332_2.png) [@Szymon](https://forum.bubble.io/u/Szymon)\
**Post date:** [June 15, 2020, 6:50pm UTC](https://forum.bubble.io/t/bubble-api-connector-processing-http-error-status-codes/5685/17 "2020-06-15T18:50:12Z")

</div>

I see that it is impossible to process error _codes_, but is it possible to process errors _at all_?  
I’m putting some data retrieved from API call into a text element. If the API call returns an error, the text element content is left empty. I want to use a condition that “if API call returns any error, put _error_ in text element content”. Is it possible to do in Bubble?

---

<div class="post-metadata">

**Author:** ![joshbrady2](https://avatars.discourse-cdn.com/v4/letter/j/c67d28/32.png) [@joshbrady2](https://forum.bubble.io/u/joshbrady2)\
**Post date:** [August 7, 2020, 3:19pm UTC](https://forum.bubble.io/t/bubble-api-connector-processing-http-error-status-codes/5685/18 "2020-08-07T15:19:47Z")

</div>

If this were a thing it would be extremely helpful!

---

<div class="post-metadata">

**Author:** ![Szymon](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/szymon/32/61332_2.png) [@Szymon](https://forum.bubble.io/u/Szymon)\
**Post date:** [September 2, 2020, 8:01pm UTC](https://forum.bubble.io/t/bubble-api-connector-processing-http-error-status-codes/5685/19 "2020-09-02T20:01:10Z")

</div>

Hi all!  
This issue is already very old. Are there any plans now to implement this additional feature? It’d be very helpful (not to say crucial) for many Bubble apps. 🤔  
@emmanuel @allenyang

---

<div class="post-metadata">

**Author:** ![yannier.marrero](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/yannier.marrero/32/69511_2.png) [@yannier.marrero](https://forum.bubble.io/u/yannier.marrero)\
**Post date:** [October 1, 2020, 5:04am UTC](https://forum.bubble.io/t/bubble-api-connector-processing-http-error-status-codes/5685/20 "2020-10-01T05:04:02Z")

</div>

Any update on this? I have a GET API CALL that needs to validate if an email has been already in use with the API provider.

Thanks in advance…

[Next page](https://forum.bubble.io/t/bubble-api-connector-processing-http-error-status-codes/5685.md?page=2)
