Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

161
Vistas
No 'Access-Control-Allow-Origin' header is present on the requested resource when a header is present on the requested source

Sorry for asking this question when it's a lot of answers to these questions out there already, but I have tried almost everything and it's still not working. I'm making an API call to an API hosted on replit. This has worked fine until yesterday, I don't know what I did yesterday that f*cked up my code. When making the API call, I get the CORS error: No 'Access-Control-Allow-Origin' header is present on the requested resource, but I have a header with 'Access-Control-Allow-Origin' in my response.

Really appreciate all your help!

API code:

app.use(bodyParser.urlencoded({ extended: true }))
app.use(bodyParser.json())

app.use(cors())

app.post('/invoicing', cors(), async (req, res) => {
  res.header('Access-Control-Allow-Origin', '*');
  res.header('crossorigin', 'true')
  res.header("Access-Control-Allow-Headers", "Origin, X-Requested-With, Content-Type, Accept"); 
    try {
        const product = await stripe.products.create({
            name: 'Test'
        })

        const price = await stripe.prices.create({
            product: product.id,
            unit_amount: 10000,
            currency: 'nok',
        })

    const customer = await stripe.customers.create({
            name: 'Daniel Olsen',
            email: 'olsen.daniel04@gmail.com',
            description: 'Customer',
        })

        const invoiceItem = await stripe.invoiceItems.create({
            customer: customer.id,
            price: price.id,
        })

        const invoice = await stripe.invoices.create({
            customer: customer.id,
            auto_advance: true,
        })

        const invoiceFinalize = await stripe.invoices.finalizeInvoice(invoice.id)

        console.log(invoiceFinalize)
        console.log(customer)
        res.json({
            success: true,
            message: 'Yeeet'
        })

    } catch (error) {
        console.log(error)
        res.json({
            message: "Payment failed",
            success: false
        })
    }
})
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda