Comments (7)
Could you forward me the exact code that you are using? I'd like to debug through it since I am not able to reproduce the issue.
from facebook-nodejs-business-sdk.
account
.createCampaign([], {
[Campaign.Fields.name]: "Campaign name",
[Campaign.Fields.status]: Campaign.Status.paused,
[Campaign.Fields.objective]: "LINK_CLICKS",
[Campaign.Fields.spend_cap]: 12000
})
.then(campaign => {
console.log("integration:facebook:createdCampaign", campaign);
});
from facebook-nodejs-business-sdk.
What surprises me is that the error message knows about a campaign id (SOME_CAMPAIGN_ID
) even though at this point the campaign creation didn't go through.
from facebook-nodejs-business-sdk.
Not sure if this helps, but here is a stack trace that is printed in the terminal.
at FacebookRequestError.FacebookError [as constructor] (/Code/node_modules/facebook-nodejs-ads-sdk/dist/cjs.js:314:16)
at new FacebookRequestError (/Code/node_modules/facebook-nodejs-ads-sdk/dist/cjs.js:337:129)
at /Code/node_modules/facebook-nodejs-ads-sdk/dist/cjs.js:456:15
at tryCatcher (/Code/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Code/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/Code/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/Code/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/Code/node_modules/bluebird/js/release/promise.js:689:18)
at Async._drainQueue (/Code/node_modules/bluebird/js/release/async.js:133:16)
at Async._drainQueues (/Code/node_modules/bluebird/js/release/async.js:143:10)
at Immediate.Async.drainQueues (/Code/node_modules/bluebird/js/release/async.js:17:14)
at runCallback (timers.js:781:20)
at tryOnImmediate (timers.js:743:5)
at processImmediate [as _immediateCallback] (timers.js:714:5)
from facebook-nodejs-business-sdk.
@zanyaziz Let me know, I can also provide a lightweight example within a express.js app.
from facebook-nodejs-business-sdk.
@roundrobin Hey, I've got bug that acts same as you described, also the stacktrace is same. It happens when I make subsequent requests and it's because the AdAccountId (or whatever other id should be in the request url) is different (f. e. not the one I entered as argument when creating AdAccount).
Can you please check if it happens to you too?
{ error:
{ message: 'Unsupported post request. Object with ID \'12033000xxx\' does not exist, cannot be loaded due to missing permissions, or does not support this operation. Please read the Graph API documentation at https://developers.facebook.com/docs/graph-api',
type: 'GraphMethodException',
code: 100,
error_subcode: 33,
fbtrace_id: 'AXwvThfAkIs' } },
method: 'POST',
url: 'https://graph.facebook.com/v2.10/1203300xxx/ads?access_token=xxx',
from facebook-nodejs-business-sdk.
@zanyaziz Okay, so here you have a snippet that shows how i made it work again:
(also try to comment out the line I marked to see the error)
const { FacebookAdsApi, AdAccount, Ad, AdCreative } = require('facebook-nodejs-ads-sdk')
const config = require('../config')
const fbAdsApi = FacebookAdsApi.init(config.fb.marketingApiKey)
if (process.env.NODE_ENV !== 'production') {
fbAdsApi.setDebug(true)
}
const fbAccount = new AdAccount('act_' + config.fb.marketingAdId)
module.exports.createAd = async function createAd(survey) {
const adCreativeResponse = await fbAccount.createAdCreative(
[],
{
[AdCreative.Fields.name]: survey.title,
[AdCreative.Fields.title]: survey.title,
[AdCreative.Fields.body]: survey.description,
[AdCreative.Fields.link_url]: 'https://google.com,
[AdCreative.Fields.object_url]: 'https://google.com',
[AdCreative.Fields.image_url]: survey.photo.url
}
)
// HERE:
// this is how I set the right id and this solves the issue, I think this can help you find where the problem is
fbAccount._data.id = 'act_' + config.fb.marketingAdId
// This second part throws error, but completely different and related to fields
const adResponse = await fbAccount.createAd(
[],
{
[Ad.Fields.name]: `Survey with title: ${survey.title}`,
[Ad.Fields.creative]: { creative_id: adCreativeResponse.id },
[Ad.Fields.status]: Ad.Status.paused
}
)
return adResponse
}
from facebook-nodejs-business-sdk.
Related Issues (20)
- Issue importing 'FacebookRequestError' HOT 3
- Trying to run one of the basic SDK examples results in SDK crash HOT 1
- `AdVideo` fields are incorrect
- `getAds` never returns `video_id` field
- Is it possible to filter on Ad Creatives based on updated_at the way we do it in AdSets??
- How to have types / intellisense?
- Compile error because of partner_agent HOT 1
- App Events got ineligible for Meta AEM HOT 4
- How to filter leads by field_data or id?
- How to get the total spent amount for a campaign?
- Undefined headers in successful responses HOT 4
- Advertisers in Russia cannot create or run ads at this time. HOT 1
- Should AdCreativeLinkData.FormatOption include collection_video? HOT 1
- Can't set referrer url in ServerEvent HOT 1
- Is it possible to copy a leadgen form?
- Omitting 'fields' Query Parameter in FacebookAdsApiBatch via APIRequest with facebook-nodejs-business-sdk
- Getting a problematic warning when using the latest @types version
- Is there any changelog for changes from 19 to 20?
- Currency code capitalization? HOT 2
- Not able to access Business User Insights for multiple users using the Instagram API. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from facebook-nodejs-business-sdk.