facebook-nodejs-business-sdk
facebook-nodejs-business-sdk copied to clipboard
data_processing_options_country and data_processing_options_state are not sent when set to 0
Which SDK version are you using?
11
What's the issue?
The LDU flags data_processing_options_country and data_processing_options_state are not sent when their values are set to zero.
Steps/Sample code to reproduce the issue
.setDataProcessingOptions(['LDU']);
.setDataProcessingOptionsCountry(0);
.setDataProcessingOptionsState(0);
Observed Results:
FacebookRequestError: Invalid Values for Country and State Data Processing Options: The values you entered for data_processing_options_country and data_processing_options_state are invalid as a combination. Valid combinations are 0 and 0, or 1 and 1000.
Expected Results:
Both values should be sent when set to 0 as part of the payload.
Proposed solution.
Change the current truthy check in serverside/server-event.js to allow for a 0 value
Current
if (this.data_processing_options_country) {
serverEvent.data_processing_options_country = this.data_processing_options_country;
}
if (this.data_processing_options_state) {
serverEvent.data_processing_options_state = this.data_processing_options_state;
}
Proposed
if (this.data_processing_options_country || this.data_processing_options_country === 0) {
serverEvent.data_processing_options_country = this.data_processing_options_country;
}
if (this.data_processing_options_state || this.data_processing_options_state === 0) {
serverEvent.data_processing_options_state = this.data_processing_options_state;
}
Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. Thank you for your contributions.
I have the same issue. It is still present in version 13 of the SDK, too.
closed as #214 is merged.