facebook / facebook-ruby-business-sdk

Ruby SDK for Meta Marketing API
https://developers.facebook.com/docs/business-sdk
Other
209 stars 160 forks source link

Adding users to newly created custom audiences is returning error (#803) Some of the aliases you requested do not exist: users #124

Open jkhulme opened 3 years ago

jkhulme commented 3 years ago

Which SDK version are you using?

9.0.1 (but was seeing the same issue in 8.0.3 and earlier)

What's the issue?

We have a sidekiq worker that creates a custom audience and then adds users to it. On the first run it fails with error (#803) Some of the aliases you requested do not exist: users (our latest fbtrace_id is AwzHWs8cEb1y75r_tiOwMAs) Sidekiq then retries the job, and the worker succeeds, and users are added to our custom audience.

I can't see anything in the docs that suggest there is a lag between when an audience is created and when it is usable, and adding a delay in manually did not fix the issue. I'm stumped by it.

Steps/Sample code to reproduce the issue

audience = FacebookAds::AdAccount.get(account_id).customaudiences.create(
  name: audience_name,
  subtype: 'CUSTOM',
  customer_file_source: 'USER_PROVIDED_ONLY'
)
...
payload = {
  schema: %w[EMAIL_SHA256 PHONE_SHA256],
  data: [...]
}
FacebookAds::CustomAudience.get(audience.id).users.create(payload: payload.to_json)

Observed Results:

When FacebookAds::CustomAudience.get(audience.id).users.create(payload: payload.to_json) is the first time we get an error like FacebookAds::ClientError: (#803) Some of the aliases you requested do not exist: users: (fbtrace_id: AwzHWs8cEb1y75r_tiOwMAs) the job is then retried by sidekiq about 30s later and succeeds.

Expected Results:

It should succeed first time and not need to retry

jkhulme commented 3 years ago

This isn't a temporary network issue, we have had this error constantly for over a year, running at different times of day. Always succeeding on the retry

stale[bot] commented 2 years ago

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.