Interruzione parzialeshare-external
Unknown 500 error
5

Hello, I am using the Facebook Nodejs business SDK to pull ad campaigns from a specific ad account. The way I do it is I initialize a new AdAccount using a valid id and then simply use the .getCampaigns method to pull the 'id' and 'name' params. This worked well about a week ago. However, since a few days, I have been getting the following response from the graph API when calling the getCampaigns method:

message: 'An unknown error has occurred.', status: 500, response: { message: 'An unknown error has occurred.', type: 'OAuthException', code: 1,

FYI, I do not think this has something to do with the access token since I am able to perform other operations such as getting ad insights or getting ad accounts.

For more context, here is my function:

async function fetchCampaigns(accountId: string) { const AdAccount = bizSdk.AdAccount; const adAccount = new AdAccount(accountId); let fields, params; fields = [ 'id', 'name', ]; params = { 'effective_status' : ['ACTIVE','PAUSED'], }; try { const campaignsResponse = await adAccount.getCampaigns(fields, params); return campaignsResponse.map((campaign: { id: any; name: any; }) => ({ id: campaign.id, name: campaign.name })); } catch (error) { throw error; } }

Allen
Chiesta circa 3 mesi fa
Risposta selezionata
1

This has been resolved, as Meta updated the endpoint to accept an empty data parameter.

2 ottobre alle ore 06:04
Danny
4

Hello, Anyone willing to help?

11 settembre alle ore 01:18
Allen
Jose

Hi, I am experiencing the same issue since today

11 settembre alle ore 02:54
David

First noticed a very similar issue yesterday.

12 settembre alle ore 03:17
David

Oddly, I'm only seeing this with the SDK. I can make queries via the explorer perfectly well. Simply trying to retrieve the name of an act_XXX gives the same error. Taking the URL from the error message and using cURL works just fine.

12 settembre alle ore 03:19
David

I have access to two accounts, and get the same behaviour with both. I tried regenerating the tokens, checking permissions and making sure they're valid. The code worked earlier this month.

12 settembre alle ore 03:20
David

Update: I replaced the SDK with direct URL fetches the graph API and it works. The SDK seems to be pretty buggy, it regularly just crashes for me if there's an error, I think we'll remove it from our code.

12 settembre alle ore 04:40
Danny

We're seeing the exact same issue. Happy to provide any details here that would be helpful.

12 settembre alle ore 10:49
Danny

For anyone who knows what this means - it's because the SDK is adding a default "data: {}" to the axios' get request.

The minimal reproduction of it is this: curl --location --request GET 'https://graph.facebook.com/v19.0/120203564697850515?fields=status&access_token=XXXX' \ --header 'User-Agent: fbbizsdk-nodejs-v19.0.3' \ --header 'Content-Type: application/json' \ --data '{}'

Where you replace XXXX with your token. Note that typically, GET requests don't get handed that data parameter, and if you remove it, the request succeeds.

12 settembre alle ore 11:07
Danny

I have submitted an issue to the Github repo outlining the problem here: https://github.com/facebook/facebook-nodejs-business-sdk/issues/298

Would be helpful for others to upvote this.

12 settembre alle ore 12:19