CORS issue when developing static client locally

Hello,

I developed and tested node.js business logic(API service). This code calls an external API (stripe payment gateway).
I run the code in debug mode from my client via coderunner.
I have tested it by invoking it via console and it works like expected.

But invocation from my javascript client fails with this error message in the browser console:

Access to XMLHttpRequest at 'https://checkout.stripe.com/pay/<myStripeAPIKeyHere>' 
(redirected from 'https://eu-api.backendless.com/<MyBackendlessAppIdHere>/services/PaymentService/checkoutApi') 
from origin 'http://localhost:4000' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I have tried invocation of the service in my js client via

  1. fetch
  2. axios.post
  3. BackendlessRequest.post
  4. Backendless.APIServices.invoke

My client is served locally to localhost via vite, a development web server.

In the backendless console I allowed CORS for *

Everythings works fine if I use standard html form submit. Then CORS is not an issue. But with the above described methods I get an error.

I understand that the error should disappear if I would serve the client in the files/web section of backendless. But since you have dropped the git support and there is no deployment script available for static files, the development cycle becomes terrible:

  1. locally develop HTML and JS
  2. zip
  3. log into backendless console and drag/drop zip to /files/web
  4. unzip
  5. test and find a bug
  6. goto 1

Is there any way to deploy static files via script? (my goal: npm run deploy-backendless-static)
Is there anything I have done wrong in the Domain CORS section of backendless console?

Hello @Odo_Maletzki!

Sorry for the late reply.
Could you give me a more detailed description so I can reproduce this issue?

Regards,
Alexander