flutter-client-sdk icon indicating copy to clipboard operation
flutter-client-sdk copied to clipboard

Errors when using Web Assembly (wasm)

Open luizpaulofranz opened this issue 9 months ago • 8 comments

Is this a support request? Yes

Describe the bug I have migrated our web project to web assembly (wasm), and after that, I am getting several CORS errors on launch darkly.

To reproduce Add the launchdarkly_flutter_client_sdk: ^4.7.0 on a web project make all required configurations and build it for wasm. When you try to access the web version, you will get a bunch of CORS errors.

Expected behavior No CORS errors.

Logs Error from the browser

       GET https://clientstream.launchdarkly.com/eval//eyJraW5kIjoibXVsdGkiLCJkZXZpY2UiOnsia2V5IjoiY2UzZDAwNDMtMjNhNy00NGNjLTlkYmMtZjM2N2E5ODg0MDAyIiwiYW5vbnltb3VzIjp0cnVlfSwibGRfYXBwbGljYXRpb24iOnsia2V5IjoiSER0MHlYc2RpbjZrbFBNcGlpaElUdVNIeFpOMG5yVktLVlpzemdIdWNJWT0iLCJuYW1lIjoib3R0b19hcHAiLCJpZCI6Im90dG9fYXBwIiwidmVyc2lvbk5hbWUiOiIxLjcuMyIsImxvY2FsZSI6ImVuLVVTIiwiZW52QXR0cmlidXRlc1ZlcnNpb24iOiIxLjAifX0= net::ERR_FAILED 301 (Moved Permanently)Understand this errorAI
192.168.3.109/:1 Access to resource at 'https://clientstream.launchdarkly.com/eval//eyJraW5kIjoibXVsdGkiLCJkZXZpY2UiOnsia2V5IjoiY2UzZDAwNDMtMjNhNy00NGNjLTlkYmMtZjM2N2E5ODg0MDAyIiwiYW5vbnltb3VzIjp0cnVlfSwibGRfYXBwbGljYXRpb24iOnsia2V5IjoiSER0MHlYc2RpbjZrbFBNcGlpaElUdVNIeFpOMG5yVktLVlpzemdIdWNJWT0iLCJuYW1lIjoib3R0b19hcHAiLCJpZCI6Im90dG9fYXBwIiwidmVyc2lvbk5hbWUiOiIxLjcuMyIsImxvY2FsZSI6ImVuLVVTIiwiZW52QXR0cmlidXRlc1ZlcnNpb24iOiIxLjAifX0=' from origin 'https://192.168.3.109' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. 

// Most relevant part of the error:
No 'Access-Control-Allow-Origin' header is present on the requested resource. 

SDK version 4.7.0

Language version, developer tools Flutter 3.27.0 Framework • revision 8495dee1fd (5 weeks ago) • 2024-12-10 14:23:39 -0800 Engine • revision 83bacfc525 Tools • Dart 3.6.0 • DevTools 2.40.2

Additional context This error doesn't happen if I use normal web build, it only happens when I use wasm to build. It successful build, but we got these errors.

Another weird thing that we discovered is that when we are using the WASM build, the failing CORS requests of launch darkly are going with the wrong URL, like this: https://clientstream.launchdarkly.com/eval//eyJra...... -> Look after the eval. I believe there should appear the client ID. It's important enforce that if we use normal web builds (no wasm) this error doesn't happens.

Image

luizpaulofranz avatar Jan 13 '25 21:01 luizpaulofranz