-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: sp.setup is not a function #12
Comments
Hi @dma82, To use PnPjs, it's dependencies should be imported. Please check https://pnp.github.io/pnpjs/getting-started/ Import taxonomy (sub package is not enough). |
Hi @koltyakov, Thank you for your reply. Apologies, in my previous example I forgot to show you an extract of my package.json (out of desperation I eventually started to install even the basic libraries (the ones not for CommonJS):
But despite having all dependencies, I'm getting this nasty error... Thank you. Regards, |
@dma82, specific PnPjs packages not only should be installed but actually imported. Did you try something structurally like this: import { bootstrap } from 'pnp-auth';
import { sp } from '@pnp/sp-commonjs';
import "@pnp/sp/taxonomy-commonjs";
bootstrap(sp, authData);
const info = await sp.termStore.groups.getById("338666a8-1111-2222-3333-f72471314e72")
.sets.getById("338666a8-1111-2222-3333-f72471314e72").get();
// ... |
Hi @koltyakov, I've tried this but still no joy:
With pnp-auth v.0.0.4 and sp-taxonomy v.1.3.11 I was able to retrieve the taxonomy list, but those libraries are quite old... Thank you |
LOL, I wanted to ask a fellow from https://github.com/pnp/pnpjs/discussions/2004 discussion who recently was successful with the same setup with taxonomy, but it was you. |
LOL! Yes it was me, but with the old libraries! With the new ones somehow I'm having issues... Problem is even with the old libraries I'm having loads of "circular dependency" warnings, so it seems no matter what I do I just incur in issues lol! |
Hi @koltyakov, Just a quick update: instead of using the import at the beginning of my module, I imported it in my function:
And now I'm getting a different error lol:
Same error if I use this:
|
Which bring us back to pnp/pnpjs#2004: that means I'm going round in circle LOL! |
Not promising, but let me try to assemble an example with taxonomy. However, could do it only over the weekend. If you’ll manage finding a solution before it, please let me know. What are the limitations? Just wondering, what are the stoppers for using TypeScript and latest Node.js and latest versions of other ingredients? |
Hi @koltyakov, I surely will let you know if I manage to find a solution. My limitation for using Typescript is that I need to re-use an existing module in CommonJS so at the present moment I can't migrate the whole solution... With regards to Node, I'm actually using the latest version (v.16). I don't know if the problem now is the credentials (I'm using username and password) or if I'm trying to retrieve the term store in the wrong way... Thank you in advance for any help you can give me, much appreciated :) |
Just offtopic. TypeScript allows using JS (https://www.typescriptlang.org/tsconfig#allowJs) and allows incremental migration. |
Hey @dma82, Looks that the modern Taxonomy API only can be accessed with Azure AD auth. There is no such strategy currently in node-sp-auth. |
Hi @koltyakov , Unfortunately I suspected that this strategy was no longer supported but wasn't sure which module was responsible for this... I might contact their development team and start bugging them lol! :D Thank you so much for all your time and help on this,, I really appreciated it! |
@dma82 I suppose you haven't been successful in the meantime. I just wasted the better half of an afternoon to try the same thing until I stumbled upon this github issue. So no luck with pnp-auth then. I want to update Taxonomy fields and a test case works, using |
Hi,
I installed pnp-auth v2.0.0 and @pnp/sp-commonjs v2.11.0 and I'm using them in my project in this way:
But I send my request, I get this error:
Am I doing anything wrong or is this a bug?
Thank you.
The text was updated successfully, but these errors were encountered: