facebook / facebook-ruby-business-sdk

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

FacebookAds::Campaign.get('uid') return syntax error #56

Closed Flexoman closed 5 years ago

Flexoman commented 5 years ago

Please fix that error ALL api.has_param :fb:channel, 'string' api.has_param :image:height, 'int' ....

in files /lib/facebook_ads/ad_objects/user.rb /lib/facebook_ads/ad_objects/group.rb

than uninitialized constant FAMEAdCampaign must be a FameAdCampaign in /lib/facebook_ads/ad_objects/campaign.rb

thanks

dianpan commented 5 years ago

Seeing similar errors when I upgraded to v0.3.1.2

SyntaxError: /gems/facebookbusiness-0.3.1.2/lib/facebook_ads/ad_objects/user.rb:189: syntax error, unexpected ':', expecting keyword_end
        api.has_param :fb:channel, 'string'
                         ^
/gems/facebookbusiness-0.3.1.2/lib/facebook_ads/ad_objects/user.rb:189: syntax error, unexpected '\n', expecting &. or :: or '[' or '.'
...has_param :fb:channel, 'string'
...                               ^
/gems/facebookbusiness-0.3.1.2/lib/facebook_ads/ad_objects/user.rb:193: syntax error, unexpected ':', expecting keyword_end
        api.has_param :fb:explicitly_shared, 'bool'
                         ^
/gems/facebookbusiness-0.3.1.2/lib/facebook_ads/ad_objects/user.rb:193: syntax error, unexpected '\n', expecting &. or :: or '[' or '.'
...m :fb:explicitly_shared, 'bool'
...                               ^
/gems/facebookbusiness-0.3.1.2/lib/facebook_ads/ad_objects/user.rb:194: syntax error, unexpected ':', expecting keyword_end
        api.has_param :image:height, 'int'
kerwin-personalyze commented 5 years ago

same here. getting the same error.

 /Users/*****/.rvm/rubies/ruby-2.4.4/lib/ruby/gems/2.4.0/gems/facebookbusiness-0.3.1.4/lib/facebook_ads/ad_objects/user.rb:189: syntax error, unexpected ':', expecting keyword_end
               api.has_param :fb:channel, 'string'
                                 ^
       /Users/*****/.rvm/rubies/ruby-2.4.4/lib/ruby/gems/2.4.0/gems/facebookbusiness-0.3.1.4/lib/facebook_ads/ad_objects/user.rb:189: syntax error, unexpected '\n', expecting &. or :: or '[' or '.'
       /Users/*****/.rvm/rubies/ruby-2.4.4/lib/ruby/gems/2.4.0/gems/facebookbusiness-0.3.1.4/lib/facebook_ads/ad_objects/user.rb:193: syntax error, unexpected ':', expecting keyword_end
               api.has_param :fb:explicitly_shared, 'bool'
                                 ^
       /Users/*****/.rvm/rubies/ruby-2.4.4/lib/ruby/gems/2.4.0/gems/facebookbusiness-0.3.1.4/lib/facebook_ads/ad_objects/user.rb:193: syntax error, unexpected '\n', expecting &. or :: or '[' or '.'
       /Users/*****/.rvm/rubies/ruby-2.4.4/lib/ruby/gems/2.4.0/gems/facebookbusiness-0.3.1.4/lib/facebook_ads/ad_objects/user.rb:194: syntax error, unexpected ':', expecting keyword_end
               api.has_param :image:height, 'int'
                                    ^
       /Users/*****/.rvm/rubies/ruby-2.4.4/lib/ruby/gems/2.4.0/gems/facebookbusiness-0.3.1.4/lib/facebook_ads/ad_objects/user.rb:194: syntax error, unexpected '\n', expecting &. or :: or '[' or '.'
       /Users/*****/.rvm/rubies/ruby-2.4.4/lib/ruby/gems/2.4.0/gems/facebookbusiness-0.3.1.4/lib/facebook_ads/ad_objects/user.rb:195: syntax error, unexpected ':', expecting keyword_end
               api.has_param :image:secure_url, 'string'
                                    ^
       /Users/*****/.rvm/rubies/ruby-2.4.4/lib/ruby/gems/2.4.0/gems/facebookbusiness-0.3.1.4/lib/facebook_ads/ad_objects/user.rb:195: syntax error, unexpected '\n', expecting &. or :: or '[' or '.'
       /Users/*****/.rvm/rubies/ruby-2.4.4/lib/ruby/gems/2.4.0/gems/facebookbusiness-0.3.1.4/lib/facebook_ads/ad_objects/user.rb:196: syntax error, unexpected ':', expecting keyword_end
               api.has_param :image:type, 'string'
                                    ^
       /Users/*****/.rvm/rubies/ruby-2.4.4/lib/ruby/gems/2.4.0/gems/facebookbusiness-0.3.1.4/lib/facebook_ads/ad_objects/user.rb:196: syntax error, unexpected '\n', expecting &. or :: or '[' or '.'
       /Users/*****/.rvm/rubies/ruby-2.4.4/lib/ruby/gems/2.4.0/gems/facebookbusiness-0.3.1.4/lib/facebook_ads/ad_objects/user.rb:197: syntax error, unexpected ':', expecting keyword_end
               api.has_param :image:url, 'string'
                                    ^
       /Users/*****/.rvm/rubies/ruby-2.4.4/lib/ruby/gems/2.4.0/gems/facebookbusiness-0.3.1.4/lib/facebook_ads/ad_objects/user.rb:197: syntax error, unexpected '\n', expecting &. or :: or '[' or '.'
       /Users/*****/.rvm/rubies/ruby-2.4.4/lib/ruby/gems/2.4.0/gems/facebookbusiness-0.3.1.4/lib/facebook_ads/ad_objects/user.rb:198: syntax error, unexpected ':', expecting keyword_end
               api.has_param :image:user_generated, 'bool'
                                    ^
       /Users/*****/.rvm/rubies/ruby-2.4.4/lib/ruby/gems/2.4.0/gems/facebookbusiness-0.3.1.4/lib/facebook_ads/ad_objects/user.rb:198: syntax error, unexpected '\n', expecting &. or :: or '[' or '.'
       /Users/*****/.rvm/rubies/ruby-2.4.4/lib/ruby/gems/2.4.0/gems/facebookbusiness-0.3.1.4/lib/facebook_ads/ad_objects/user.rb:199: syntax error, unexpected ':', expecting keyword_end
               api.has_param :image:width, 'int'
                                    ^
       /Users/*****/.rvm/rubies/ruby-2.4.4/lib/ruby/gems/2.4.0/gems/facebookbusiness-0.3.1.4/lib/facebook_ads/ad_objects/user.rb:199: syntax error, unexpected '\n', expecting &. or :: or '[' or '.'
       /Users/*****/.rvm/rubies/ruby-2.4.4/lib/ruby/gems/2.4.0/gems/facebookbusiness-0.3.1.4/lib/facebook_ads/ad_objects/user.rb:649: syntax error, unexpected ':', expecting keyword_end
               api.has_param :fb:channel, 'string'
                                 ^
       /Users/*****/.rvm/rubies/ruby-2.4.4/lib/ruby/gems/2.4.0/gems/facebookbusiness-0.3.1.4/lib/facebook_ads/ad_objects/user.rb:649: syntax error, unexpected '\n', expecting &. or :: or '[' or '.'
       /Users/*****/.rvm/rubies/ruby-2.4.4/lib/ruby/gems/2.4.0/gems/facebookbusiness-0.3.1.4/lib/facebook_ads/ad_objects/user.rb:653: syntax error, unexpected ':', expecting keyword_end
               api.has_param :fb:explicitly_shared, 'bool'
                                 ^
       /Users/*****/.rvm/rubies/ruby-2.4.4/lib/ruby/gems/2.4.0/gems/facebookbusiness-0.3.1.4/lib/facebook_ads/ad_objects/user.rb:653: syntax error, unexpected '\n', expecting &. or :: or '[' or '.'
       /Users/*****/.rvm/rubies/ruby-2.4.4/lib/ruby/gems/2.4.0/gems/facebookbusiness-0.3.1.4/lib/facebook_ads/ad_objects/user.rb:654: syntax error, unexpected ':', expecting end-of-input
               api.has_param :image:height, 'int'
csroberson commented 5 years ago

Yep, same here:

2.2.3 :010 > user = FacebookAds::User.get(id) SyntaxError: /Users/.../gems/facebookbusiness-0.3.1.5/lib/facebook_ads/ad_objects/user.rb:239: syntax error, unexpected ':', expecting keyword_end api.has_param :fb:channel, 'string' ^

Any idea what is causing this? Seems rather fundamental.

csroberson commented 5 years ago

Please fix that error ALL api.has_param :fb:channel, 'string' api.has_param :image:height, 'int' ....

@Flexoman, I was looking at the code and the form :fb:... is used in several places as is :image:.... I see the # FB:AUTOGEN comment in most, if not all, of the files I've examined so far; so it looks like something went wrong in generation of this version. Do you have any idea what it may be? I can see that the previous version from July 27 does not have this syntax:

https://github.com/facebook/facebook-ruby-business-sdk/commit/19e232f9196edb050b6ba9a55b0242d1ba4d3c40

You reported this 21 days ago and I'm surprised it has not been addressed as it seems like this release is quite questionable.

in files /lib/facebook_ads/ad_objects/user.rb /lib/facebook_ads/ad_objects/group.rb

than uninitialized constant FAMEAdCampaign must be a FameAdCampaign in /lib/facebook_ads/ad_objects/campaign.rb

FWIW, I don't see that constant, FAMEAdCampaign, in the campaign.rb file. Maybe I'm missing something.

thanks

I'm going to try reverting back a version or two.

csroberson commented 5 years ago

@jingping2015, @codytwinton, @vicdus, and/or @facebook-github-bot are you folks aware of this issue? All you need to do to recreate is run the example: https://github.com/facebook/facebook-ruby-business-sdk/blob/master/examples/UserAccountsEdge.rb

require 'facebook_ads'

access_token = '<ACCESS_TOKEN>'
app_secret = '<APP_SECRET>'
app_id = '<APP_ID>'
id = '<ID>'

FacebookAds.configure do |config|
  config.access_token = access_token
  config.app_secret = app_secret
end

user = FacebookAds::User.get(id)

I can reproduce this problem in 0.3.1.0 and 0.3.1.5 on a system running Ruby 2.2.3. I have to go all the way back to 0.3.0.6 for the error not to happen.

codytwinton commented 5 years ago

Thanks for alerting us. We’re a small team working on the available business SDKs, but we’ll do our best to address this soon.

jingping2015 commented 5 years ago

Hi everyone, thanks for reporting this bug. I think we already fix this issue in our recent release, for example : https://github.com/facebook/facebook-ruby-business-sdk/blob/c422b0e70897f0daa97b48205acb8f431cd7d8ce/lib/facebook_ads/ad_objects/user.rb#L241

Let me know if we miss any cases. (Please add the permalink, appreciate it!)

joaquindiaz01 commented 5 years ago

anyone still getting same error?

An Array ({"GEM_PATH"=>["/home/joaquin/.rvm/gems/ruby-2.2.4", "/home/joaquin/.rvm/gems/ruby-2.2.4@global"]}) was passed in from bin/rails:3:in 'load' /home/joaquin/.rvm/gems/ruby-2.2.4/gems/polyglot-0.3.5/lib/polyglot.rb:65:in 'require': /home/joaquin/.rvm/gems/ruby-2.2.4/gems/facebook_ads-0.6.6/lib/facebook_ads/ad_set.rb:104: syntax error, unexpected '.' (SyntaxError) breakdowns: breakdowns&.join(','), ^ /home/joaquin/.rvm/gems/ruby-2.2.4/gems/facebook_ads-0.6.6/lib/facebook_ads/ad_set.rb:104: syntax error, unexpected ',', expecting keyword_end /home/joaquin/.rvm/gems/ruby-2.2.4/gems/facebook_ads-0.6.6/lib/facebook_ads/ad_set.rb:105: syntax error, unexpected ',', expecting keyword_end from /home/joaquin/.rvm/gems/ruby-2.2.4/gems/polyglot-0.3.5/lib/polyglot.rb:65:in 'require' from /home/joaquin/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in 'block in require' from /home/joaquin/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:240:in 'load_dependency' from /home/joaquin/.rvm/gems/ruby-2.2.4/gems/activesupport-4.2.10/lib/active_support/dependencies.rb:274:in 'require' from /home/joaquin/.rvm/gems/ruby-2.2.4/gems/facebook_ads-0.6.6/lib/facebook_ads.rb:12:in 'block in <top (required)>' from /home/joaquin/.rvm/gems/ruby-2.2.4/gems/facebook_ads-0.6.6/lib/facebook_ads.rb:12:in 'each' from /home/joaquin/.rvm/gems/ruby-2.2.4/gems/facebook_ads-0.6.6/lib/facebook_ads.rb:12:in '<top (required)>'

I only installed the gem successfully but i can't serve my application