Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

155
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!