#mangala0687

1 messages · Page 1 of 1 (latest)

opal mulchBOT
long talon
#

Hello! Do you have a question about this error?

wooden plank
#

I'm looking at the linked error description now... ok, it looks like I need to investigate a little deeper what my code is doing

long talon
#

Yeah, doing this is a non-minified environment should provide more useful information.

wooden plank
#

is there a way I can get a non-minified environment? the build is controlled by stripe apps run

long talon
#

Can you provide more context? Where are you seeing this error? What code throws this error?

wooden plank
#

I'm developing a stripe app and at one point when handling the response to an api call the app goes blank, in debugging it I see that the ContextView is unmounting

long talon
#

Which API call?

wooden plank
#

3rd-party api, what's confusing is the network request for the api call is successful and the response is as expected, but for some reason this error gets thrown

long talon
#

Can you share the code you're using to make the request and handle the response?

wooden plank
#
                checkInfo: paymentInfo as PhysicalCheckInfo,
                signal,
                token,
            })
                .then(handleResponse)
                .catch(handleError);

#
    type: 'digital' | 'physical',
    checkInfo: DigitalCheckInfo | PhysicalCheckInfo,
    token: TokenData,
    signal: AbortSignal,
) => {
    const url = `${getBaseUrl()}/v3/check/${type}`;
    const body = JSON.stringify({
        name: checkInfo.name,
        recipient: checkInfo.recipient,
        amount: checkInfo.amount,
        description: checkInfo.description,
    });

    const response = await fetch(url, {
        method: 'POST',
        body,
        headers: {
            Authorization: `Bearer ${token.access_token}`,
            'Content-Type': 'application/json',
        },
        signal: signal,
    });

    if (response.ok) {
        console.log('response was ok')
        return (await response.json()) as SendCheckResponse;
    }

    throw new Error(await response.text());
}; ```
long talon
#

What does handleResponse look like?

wooden plank
#
            console.log('handleResponse')
            setSentPaymentInfo({
                ...paymentInfo,
                response,
            });

            // increment by the number of fields using formVersion in SendPayment.tsx
            // necessary to increment the key value so the fields are re-rendered and clear their values
            setFormVersion(formVersion + 2);

            setCurrentFocusView('Sent')
        };

long talon
#

What does setSentPaymentInfo look like?

wooden plank
#

it's from useState