Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FacebookAds\Object\AdAccount -> createAdCreative() not handling the exception properly. #27

Open
4 tasks done
nitin-aika09 opened this issue Sep 10, 2020 · 0 comments
Open
4 tasks done
Labels
bug Something isn't working

Comments

@nitin-aika09
Copy link

nitin-aika09 commented Sep 10, 2020

Checklist

  • I've updated to the latest released version (facebook/php-ads-sdk": "5.0")
  • I've searched for existing GitHub issues
  • I've looked for existing answers on Stack Overflow and the Facebook Developers Group
  • This issue is not security related and can safely be disclosed publicly on GitHub

Environment

facebook/php-ads-sdk": "5.0.*

Goals

I want to create new Creative while creating a new ad. If it fails then returns specific message returned from FB API.

Expected Results

Speicifc errpr message return from FB API like "The image couldn't be downloaded. Please wait a few minutes and try again."
What do you expect to happen?

Actual Results

"array_key_exists() expects parameter 2 to be array, null given".

What actually happened? Can you provide a stack trace?
{ "error": { "message": "Invalid parameter", "type": "OAuthException", "code": 100, "error_data": "null", "error_subcode": 1487833, "is_transient": true, "error_user_title": "Image wasn't downloaded", "error_user_msg": "Your image, https://someimage.png, couldn't be downloaded. Please wait a few minutes and try again.", "fbtrace_id": "AGIA_kW9Khu9XO05piwiXuw" } }

Steps to Reproduce

We can't provide token and other details for securoty reasons. You can just try to create a new creative by using following payload.

Code Samples & Details

Payload
{ "access_token": "XXX", "object_type": "SHARE", "object_story_spec": { "page_id": "XXX", "link_data": { "message": "Some message", "link": "https://fb.me/", "name": "test", "picture": "https://storage.googleapis.com/facebook-prod-f655/prod/Xes0M1599608679sC4Qj.png", "description": "Some descriotion", "call_to_action": { "type": "LEARN_MORE", "value": { "lead_gen_form_id": "XXX" } } } } }

Now, whenever a exception occurs getData(); method not handling that properly and not returning appropriate error message.

API call

$adAccount = new AdAccount('act_<ad_account_id>'');
$creative = $adAccount->createAdCreative([], $payload)->getData();

This function is calling createAdCreative() method in FacebookAds\Object\AdAccount class

public function createAdCreative(array $fields = array(), array $params = array(), $pending = false) {
	
	// Code stuff
}
@nitin-aika09 nitin-aika09 added the bug Something isn't working label Sep 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant