Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

186
Visualizações
Firebase Functions Axios RangeError: Maximum Call Stack Size Exceeded

I am building a Firebase cloud function that connects to merchant's website and requests a PaymentIntent object.

I'm submitting the API call via axios:

exports.getPaymentIntent = functions.https.onCall(async (data, context) => {
    // Initialise dependencies
    const axios = require('axios')
    const FormData = require('form-data')

    // Assemble payload
    let formData = new FormData()
    formData.append('amount', '10.99')
    ...

    try {
        const response = await axios.post('merchant.com/getPaymentIntent', formData, {
            headers: {
                'X-API-KEY': 'myPrivateKey'
            }
        })

        return response
    } catch (error) {
        return error
    }
})

When I run the function, it crashes with the following axios error:

Unhandled error RangeError: Maximum call stack size exceeded

I can't find out why this is happening. Removing the headers from the request doesn't change the error message either.

Is there anything I can try to fix this please?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

I found the solution few answers deep here.

I had to add an additional header in the request (on top of the X-API-KEY header):

'Content-Type': multipart/form-data; boundary=${formData._boundary}.

Setting it as just multipart/form-data would not work, so make sure you include the boundary.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda