pnp / pnpjs

Fluent JavaScript API for SharePoint and Microsoft Graph REST APIs
https://pnp.github.io/pnpjs/
Other
753 stars 305 forks source link

@zionsg Hi! Thanks for describing this issue, I've faced it as well. #2968

Closed shlokks closed 4 months ago

shlokks commented 5 months ago

Hi @batovpasha I saw your comment, I am facing similar issue but I am not able to figureout where in my code pipeline/code should I put this flag. And when I am trying in local its not working in console, could you help me understand this??

@zionsg Hi! Thanks for describing this issue, I've faced it as well. What I found: it occurs during the migration to Node.js v18 where the Request API becomes enabled by default, under the Node.js v18 you should enable it explicitly. So, disabling this API using the --no-experimental-fetch CLI flag helped me.

Originally posted by @batovpasha in https://github.com/pnp/pnpjs/issues/2823#issuecomment-1805937772

batovpasha commented 5 months ago

Hey, This is a CLI flag for the node command. So, use it like node --no-experimental-fetch index.js in your terminal.

shlokks commented 5 months ago

Let me explain briefly: Actually we are using Google AppEngine , and recently we had to update the version of runtime node version in appEngine. And it started giving this error: TypeError: Failed to parse URL from

at .Request ( node:internal/deps/undici/undici:5272 ) at .mergeHeaders ( /layers/google.nodejs.yarn/yarn_modules/node_modules/@pnp/common-commonjs/net.js:9 ) at .SPHttpClient. ( /layers/google.nodejs.yarn/yarn_modules/node_modules/@pnp/sp-commonjs/sphttpclient.js:38 ) at .step ( /layers/google.nodejs.yarn/yarn_modules/node_modules/tslib/tslib.js:143 ) at .Object.next ( /layers/google.nodejs.yarn/yarn_modules/node_modules/tslib/tslib.js:124 )

Its similar to the one where you posted this flag solution.

But the thing is we dont use Javascript files, our code is in typeScript. and one more thing is there, the appEngine is receiving a API hit when its send from frontend code, which is hosted on AWS. So should we be putting this flag on AWS side code??

And most importantly is there a way we can set it in tsconfig? or add it as a task in our YAML pipeline???

Let me know incase you need more info, as I am quite desperate to fix this issue.

patrick-rodgers commented 5 months ago

Sorry - is there a question/issue? You've deleted our issue template and not really described what is happening - did an email thread accidentally get posted back to here?

shlokks commented 5 months ago

Sorry - is there a question/issue? You've deleted our issue template and not really described what is happening - did an email thread accidentally get posted back to here?

I am facing similar issue so I posted this quoting your issue.

juliemturner commented 5 months ago

@shlokks - The error message you did share implies that you have an invalid URL, but you're not sharing any code or details on how you're using PnPjs so I'm not sure that's related. I would also point out that it appears that you're using v2 (based on NodeJS 14) which is no longer supported, that said if you're stuck using commonjs modules then I suppose you have no choice, we've found that we're able to use esmodules with all NodeJS applications by configuring our tsconfig properly and so have chosen, starting in v3 (based on NodeJS 16) the current version, not to continue publishing them.

I don't really understand from this posting what your architecture is and where PnPjs comes into the mix. We have no experience with Google AppEngine or AWS.

Long story short I will leave this open in hopes that a community member that you've mentioned will be able to assist you but unfortunately at this point there is not much we as moderators of this library can do for you.

batovpasha commented 5 months ago

@shlokks I'm not familiar with the AppEngine, but the point is that you need to pass the NODE_OPTIONS environment variable with the --no-experimental-fetch value. Link to the option in the config. So, at the end you should have something like that:

env_variables:
  NODE_OPTIONS: "--no-experimental-fetch"
patrick-rodgers commented 4 months ago

Closing this issue as answered. If you have additional questions or we did not answer your question, please open a new issue, ref this issue, and provide any additional details available. Thank you!

github-actions[bot] commented 4 months ago

This issue is locked for inactivity or age. If you have a related issue please open a new issue and reference this one. Closed issues are not tracked.