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
- fetch
- axios.post
- BackendlessRequest.post
- 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:
- locally develop HTML and JS
- zip
- log into backendless console and drag/drop zip to /files/web
- unzip
- test and find a bug
- 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?