Data API throwing AggregateError

Hey!

I’m currently facing this issue where I’m getting an AggregateError as a response from calling Bubble’s Data API. What I’m trying to do is actually very simple: I’m just trying to get an object by its unique ID after its creation. Here’s a step by step of what should happen:

  1. The object is being created directly on Bubble
  2. My Bubble app makes a call to an external backend including the unique ID as a param
  3. The external backend gets the object using the ID we just received as a param to query Bubble’s Data API

Any thoughts?

Seem to be something complex. Can you explain what you are doing exactly?
Also, can you share how you are callin Data API (API connector settings)?

Hey Jici, I’m not using the API connector to make the call to the Data API, I’m using an external backend. In case it’s useful, here’s the script:

public async GetById(id: string) : Promise<CardTemplate | null> {
        const url: string = `${this.baseUrl}/CardTemplate/${id}`;
        console.log(url);

        if(!id){
            return null;
        }

        try{
            const response: AxiosResponse = await this.bubbleDataApiClient.get(url);
            const bubbleCardTemplate = response.data?.response;
            return toCardTemplate(bubbleCardTemplate);
        }
        catch(error: any){
            console.log("error a testear: ", error?.message);
            if(error instanceof AxiosError){
                const resp = error.response?.data?.body;
                if(resp && resp.status && resp.message){
                    if(resp.status === "MISSING_DATA"){
                        return null;
                    }
                }
            }
            throw toAppError(error);
        }
    }

And what is you goal to process this way?
From what I think, the error is not returned by Bubble itself but from JS/Axios

My goal is to use the “CardTemplate” object to execute a series of steps in other APIs. I was thinking about sending this object in the body of the initial request to my external backend, but it’s also frustrating not being able to find the reason why this is not working.

The issue is also not persistent, as it happens only in certain time frames during the day