Closed aaronhayes closed 9 months ago
Hi @aaronhayes, did you end up finding out how to work around it?
@banuragaxioned could you confirm is this still an outstanding issue?
I faced the same issuse today after serveral struggle. I solve this issue by using require instead of import.
instead of this import adsSdk from 'facebook-nodejs-business-sdk';
use this const adsSdk = require('facebook-nodejs-business-sdk');
Which SDK version are you using?
13.0.0
What's the issue?
The SDK causes a crash trying to read
FacebookAdsApi.getDefaultApi().getAppID()
. We do not set the api key via theinit
method as that was causing us issues with multiple clients. Instead we always pass each object a new API object. e.g.const adAccount = new AdAccount(adAccountId, undefined, undefined, api);
TypeError: Cannot read properties of undefined (reading 'getAppID') at Object.processUncaughtException (/app/node_modules/facebook-nodejs-business-sdk/dist/cjs.js:487:35) at process. (/app/node_modules/facebook-nodejs-business-sdk/dist/cjs.js:464:30)
Steps/Sample code to reproduce the issue
Observed Results:
TypeError: Cannot read properties of undefined (reading 'getAppID') at Object.processUncaughtException (/app/node_modules/facebook-nodejs-business-sdk/dist/cjs.js:487:35) at process. (/app/node_modules/facebook-nodejs-business-sdk/dist/cjs.js:464:30)
at process.emit (node:events:539:35)
at process.emit (node:domain:475:12)
at process._fatalException (node:internal/process/execution:167:25)
at processPromiseRejections (node:internal/process/promises:279:13)
at processTicksAndRejections (node:internal/process/task_queues:97:32)