-
Notifications
You must be signed in to change notification settings - Fork 4
Description
Hello,
I'm using pnp-auth a lot :) thank you for providing this lib
I'm trying to use isolated sp objects with pnp-auth but I get the following error :
TypeError: safe_global_js_1.safeGlobal.fetch is not a function
(node:13276) UnhandledPromiseRejectionWarning: TypeError: safe_global_js_1.safeGlobal.fetch is not a function
at FetchClient.fetch (C:\Projects\sptoolkit-projects\packages\common\net.ts:66:27)
at SPHttpClient.retry (C:\Projects\sptoolkit-projects\packages\sp\sphttpclient.ts:122:24)
at C:\Projects\sptoolkit-projects\packages\sp\sphttpclient.ts:144:19
at new Promise ()
at SPHttpClient.fetchRaw (C:\Projects\sptoolkit-projects\packages\sp\sphttpclient.ts:142:16)
at SPHttpClient. (C:\Projects\sptoolkit-projects\packages\sp\sphttpclient.ts:82:21)
packages used :
"@pnp/nodejs-commonjs": "^2.6.0",
"@pnp/sp-commonjs": "^2.6.0",
"pnp-auth": "^2.0.0",
Code that produces the error:
import { bootstrap, } from 'pnp-auth';
import { sp } from '@pnp/sp-commonjs';
import { AuthConfig, } from 'node-sp-auth-config'
const isolatedSP = await sp.createIsolated()
const authConfig = new AuthConfig({
authOptions: thecredsobject
});
bootstrap(isolatedSP, authConfig)
The same code works with the standard sp object (from the import)
.....
bootstrap(sp, authConfig)
I hope you can point me to my error or fix the problem ?
thanks again
gr