facebook / facebook-java-business-sdk

Java SDK for Meta Marketing APIs
https://developers.facebook.com/docs/business-sdk
Other
402 stars 332 forks source link

Create adset failed #445

Closed easonliu30624700 closed 11 months ago

easonliu30624700 commented 11 months ago

Which SDK version are you using?

17.0.3

What's the issue?

Campaign created successfully,but when create adset,response:com.facebook.ads.sdk.APIException$FailedRequestException: {"error":{"message":"(#10) The ad account and app id must be whitelisted","type":"OAuthException","code":10,"fbtrace_id":"AL-dP53gY5ArFKnrB0QfgKa"}}

Steps/Sample code to reproduce the issue

Observed Results:

com.facebook.ads.sdk.APIException$FailedRequestException: {"error":{"message":"(#10) The ad account and app id must be whitelisted","type":"OAuthException","code":10,"fbtrace_id":"AL-dP53gY5ArFKnrB0QfgKa"}} at com.facebook.ads.sdk.APIRequest.readResponse(APIRequest.java:313) ~[facebook-java-business-sdk-17.0.3.jar:?] at com.facebook.ads.sdk.APIRequest.access$100(APIRequest.java:54) ~[facebook-java-business-sdk-17.0.3.jar:?] at com.facebook.ads.sdk.APIRequest$DefaultRequestExecutor.sendGet(APIRequest.java:539) ~[facebook-java-business-sdk-17.0.3.jar:?] at com.facebook.ads.sdk.APIRequest$DefaultRequestExecutor.execute(APIRequest.java:523) ~[facebook-java-business-sdk-17.0.3.jar:?] at com.facebook.ads.sdk.APIRequest.executeInternal(APIRequest.java:199) ~[facebook-java-business-sdk-17.0.3.jar:?] at com.facebook.ads.sdk.AdSet$APIRequestGet.execute(AdSet.java:5092) ~[facebook-java-business-sdk-17.0.3.jar:?] at com.facebook.ads.sdk.AdSet$APIRequestGet.execute(AdSet.java:5087) ~[facebook-java-business-sdk-17.0.3.jar:?] at com.facebook.ads.sdk.AdSet.fetchById(AdSet.java:207) ~[facebook-java-business-sdk-17.0.3.jar:?] at com.facebook.ads.sdk.AdSet.fetch(AdSet.java:190) ~[facebook-java-business-sdk-17.0.3.jar:?] at com.aliencloud.mktapi.facebook.api.AdOperateSDKServiceApi.createSet(AdOperateSDKServiceApi.java:207) ~[classes/:?] at com.aliencloud.admin.service.impl.MarketingApiServiceImpl.createSet(MarketingApiServiceImpl.java:440) ~[classes/:?] at com.aliencloud.admin.service.marketing.FacebookMarketingServiceImpl.createSet(FacebookMarketingServiceImpl.java:288) ~[classes/:?] at com.aliencloud.admin.service.impl.FacebookAdOperateServiceImpl.createSet(FacebookAdOperateServiceImpl.java:869) ~[classes/:?] at com.aliencloud.admin.service.impl.FacebookAdOperateServiceImpl$$FastClassBySpringCGLIB$$d8e76e7d.invoke() ~[classes/:?] at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.3.16.jar:5.3.16] at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:689) ~[spring-aop-5.3.16.jar:5.3.16] at com.aliencloud.admin.service.impl.FacebookAdOperateServiceImpl$$EnhancerBySpringCGLIB$$1c2bab12.createSet() ~[classes/:?] at com.aliencloud.admin.task.marketing.facebook.FacebookAdCreateTask.doExecute(FacebookAdCreateTask.java:144) ~[classes/:?] at com.aliencloud.admin.task.AbstractTask.execute(AbstractTask.java:57) ~[classes/:?] at com.aliencloud.admin.service.impl.CreateAdTaskServiceImpl.retry(CreateAdTaskServiceImpl.java:424) ~[classes/:?] at com.aliencloud.admin.service.impl.CreateAdTaskServiceImpl$$FastClassBySpringCGLIB$$74d926ce.invoke() ~[classes/:?] at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:218) ~[spring-core-5.3.16.jar:5.3.16] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:783) ~[spring-aop-5.3.16.jar:5.3.16] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.3.16.jar:5.3.16] at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.proceed(CglibAopProxy.java:753) ~[spring-aop-5.3.16.jar:5.3.16] at org.springframework.aop.interceptor.AsyncExecutionInterceptor.lambda$invoke$0(AsyncExecutionInterceptor.java:115) ~[spring-aop-5.3.16.jar:5.3.16] at java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:266) [?:1.8.0_101] at java.util.concurrent.FutureTask.run(FutureTask.java) [?:1.8.0_101] at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_101] at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_101] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_101] Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: https://graph.facebook.com/v17.0/120202809233250479/?access_token=xxxxxxxxxxxxxxxxxxxxxxxxxxx&fields=account_id%2Cadlabels%2Cadset_schedule%2Casset_feed_id%2Cattribution_spec%2Cbid_adjustments%2Cbid_amount%2Cbid_constraints%2Cbid_info%2Cbid_strategy%2Cbilling_event%2Cbudget_remaining%2Ccampaign%2Ccampaign_attribution%2Ccampaign_id%2Cconfigured_status%2Ccreated_time%2Ccreative_sequence%2Cdaily_budget%2Cdaily_min_spend_target%2Cdaily_spend_cap%2Cdestination_type%2Cdsa_beneficiary%2Cdsa_payor%2Ceffective_status%2Cend_time%2Cexisting_customer_budget_percentage%2Cfrequency_control_specs%2Cfull_funnel_exploration_mode%2Cid%2Cinstagram_actor_id%2Cis_dynamic_creative%2Cissues_info%2Clearning_stage_info%2Clifetime_budget%2Clifetime_imps%2Clifetime_min_spend_target%2Clifetime_spend_cap%2Cmulti_optimization_goal_weight%2Cname%2Coptimization_goal%2Coptimization_sub_event%2Cpacing_type%2Cpromoted_object%2Crecommendations%2Crecurring_budget_semantics%2Creview_feedback%2Crf_prediction_id%2Csource_adset%2Csource_adset_id%2Cstart_time%2Cstatus%2Ctargeting%2Ctargeting_optimization_types%2Ctime_based_ad_rotation_id_blocks%2Ctime_based_ad_rotation_intervals%2Cupdated_time%2Cuse_new_app_click at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[?:1.8.0_101] at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) ~[?:1.8.0_101] at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[?:1.8.0_101] at java.lang.reflect.Constructor.newInstance(Constructor.java:423) ~[?:1.8.0_101] at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1890) ~[?:1.8.0_101] at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1885) ~[?:1.8.0_101] at java.security.AccessController.doPrivileged(Native Method) ~[?:1.8.0_101] at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1884) ~[?:1.8.0_101] at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1457) ~[?:1.8.0_101] at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441) ~[?:1.8.0_101] at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254) ~[?:1.8.0_101] at com.facebook.ads.sdk.APIRequest.readResponse(APIRequest.java:292) ~[facebook-java-business-sdk-17.0.3.jar:?] ... 30 more Caused by: java.io.IOException: Server returned HTTP response code: 400 for URL: https://graph.facebook.com/v17.0/120202809233250479/?access_token=xxxxxxxxxxxxxxxxxxxxxxxxxxx&fields=account_id%2Cadlabels%2Cadset_schedule%2Casset_feed_id%2Cattribution_spec%2Cbid_adjustments%2Cbid_amount%2Cbid_constraints%2Cbid_info%2Cbid_strategy%2Cbilling_event%2Cbudget_remaining%2Ccampaign%2Ccampaign_attribution%2Ccampaign_id%2Cconfigured_status%2Ccreated_time%2Ccreative_sequence%2Cdaily_budget%2Cdaily_min_spend_target%2Cdaily_spend_cap%2Cdestination_type%2Cdsa_beneficiary%2Cdsa_payor%2Ceffective_status%2Cend_time%2Cexisting_customer_budget_percentage%2Cfrequency_control_specs%2Cfull_funnel_exploration_mode%2Cid%2Cinstagram_actor_id%2Cis_dynamic_creative%2Cissues_info%2Clearning_stage_info%2Clifetime_budget%2Clifetime_imps%2Clifetime_min_spend_target%2Clifetime_spend_cap%2Cmulti_optimization_goal_weight%2Cname%2Coptimization_goal%2Coptimization_sub_event%2Cpacing_type%2Cpromoted_object%2Crecommendations%2Crecurring_budget_semantics%2Creview_feedback%2Crf_prediction_id%2Csource_adset%2Csource_adset_id%2Cstart_time%2Cstatus%2Ctargeting%2Ctargeting_optimization_types%2Ctime_based_ad_rotation_id_blocks%2Ctime_based_ad_rotation_intervals%2Cupdated_time%2Cuse_new_app_click at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1840) ~[?:1.8.0_101] at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441) ~[?:1.8.0_101] at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480) ~[?:1.8.0_101] at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338) ~[?:1.8.0_101] at com.facebook.ads.sdk.APIRequest.readResponse(APIRequest.java:289) ~[facebook-java-business-sdk-17.0.3.jar:?] ... 30 more

Expected Results:

AdSet created successfully