Hi, We have integrated RudderStack into our Flutte...
# support
p
Hi, We have integrated RudderStack into our Flutter APP, and we are currently proxying the events through Cloudfront. While we are successfully receiving events from our Android and Web distributions, we are not seeing any events from iOS. Upon debugging, we discovered that when using Cloudfront proxy on iOS, we receive a 400 error. However, when we replace the Cloudfront Endpoint with the RudderStack endpoint, the issue is resolved. Interestingly, in the Cloudfront logs, we can observe that the 400 error is originating from RudderStack itself. Despite this, we still prefer to use the Cloudfront Proxy to circumvent Adblockers. Therefore, we would greatly appreciate some assistance regarding the integration process. We’ve used the doc below to setup Cloudfront Proxy. Thanks. https://www.rudderstack.com/docs/user-guides/how-to-guides/custom-domains/ cc: @elegant-gold-80597
k
@helpful-island-54641 do you have any insight on this ?
h
What’s the response body you have been getting with the 400 error code?
p
Copy code
2023-06-11 23:40:18.264322+0530 Runner[57836:9808026] RSStack:Info:RSCloudModeManager: CloudModeProcessor: EventCount: 11
2023-06-11 23:40:18.264695+0530 Runner[57836:9808026] RSStack:Debug:RSNetworkManager: sendNetworkRequest: requestURL <https://rlabs-dp.goinfluencer.io/v1/batch>
2023-06-11 23:40:19.030074+0530 Runner[57836:12252121] RSStack:Debug:RSNetworkManager: sendNetworkRequest: Request to url <https://rlabs-dp.goinfluencer.io/v1/batch> is successful with statusCode 400
2023-06-11 23:40:19.030220+0530 Runner[57836:12252121] RSStack:Error:RSNetworkManager: sendNetworkRequest: Request to url <https://rlabs-dp.goinfluencer.io/v1/batch> failed with statusCode 400 due to Invalid JSON
2023-06-11 23:40:19.030325+0530 Runner[57836:9808026] RSStack:Debug:RSCloudModeManager: CloudModeProcessor: cloudModeSleepCount: 414
Can share the entire logs in DM.
@helpful-island-54641 Would you be able to help?
h
The error seems to be the one with Invalid JSON … can you check if the headers are contentType headers are properly set
p
@helpful-island-54641 We are using Flutter SDK so I’m assuming this should happen automatically. I’ve tried enabling verbose logs but can’t see headers being logged. Is it possible to check at your end the reason for 400?
@helpful-island-54641 Anything that could be done here?
h
@purple-garden-33982 sorry for the delayed response but we do not log the payload/headers from our end. Since the same setup working without the CloudFront endpoint, I am not exactly sure how much can I help here since I don’t have any means to replicate the setup you are running 😞
p
Any pointers on what we can check on our end?
h
It would be really helpful if you can capture the outgoing request from your cloudfront proxy so that we can replicate the issue if any from our end
p
Let me try. Also even if payload/headers are not logged, if there are detailed error messages logged on your side, that can also help.
h
Even the log from our end would contain the same error message you have been receiving which would be Invalid JSON
👍 1
p
Looks like the requests that are gzip compressed are breaking. The issue is not limited to iOS and is also present on many android devices. Sharing request body in DM.
h
@kind-carpenter-27609 Flutter SDK doesn’t gzip compress the payload before sending it to dataplane right?
k
yeah, we can confirm it on the basis of the versions of the Android and iOS SDK versions the Flutter SDK is using. @purple-garden-33982, can you share the version of
Rudder
from the
ios/podfile.lock
file of your project ?
@purple-garden-33982, confirmed with the payload shared to Rohit, that you are version
1.6.0
of iOS, can you try setting the
Content-Encoding
header to
gzip
in your cloud front proxy ?
p
Let me try
Looks like this has worked. I’ll be monitoring throughout the day and will update here with the results. I can see some 4xx on
api
domain as well, will check that. cc: @elegant-gold-80597
👍 1
k
awesome, great to hear that. also can you confirm if you mean api.rudderlabs.com when you said
api
domain ?
p
Yes, I was referring to
<http://api.rudderlabs.com|api.rudderlabs.com>
k
Are you proxying the requests to api.rudderlabs.com as well ?
p
Yes, the
cdn
endpoint as well. This is primarily to avoid adblockers as per the docs https://www.rudderstack.com/docs/user-guides/how-to-guides/custom-domains/. Let me know if this is not required.
k
yes, this is needed to avoid adblockers
p
I monitored all the three distributions throughout the day and there were no 4xx. These are the changes: • Add
Content-Encoding
header to dataplane Cloudfront origin policy • Add origin policy on CDN as well as API Cloudfront domain with the headers listed in https://www.rudderstack.com/docs/user-guides/how-to-guides/custom-domains/#origin-request-policy-settings +
Content-Encoding
Please help in updating the above doc as well so that others don’t face the same issue.
k
Hey @purple-garden-33982, Thank you very much for letting us know with the detailed steps, we will definitely update our docs.
👍 1