Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Burnfireblaze
    @Burnfireblaze
    Hi Andrew I am facing an issue in SP Pull, any idea what could be causing this:
    Core error has happened GotError: connect ECONNREFUSED 127.0.0.1:443
    at onError (C:...\node_modules\got\dist\source\request-as-event-emitter.js:140:29)
    at handleRequest (C:....got\dist\source\request-as-event-emitter.js:173:17)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1148:16) {
    name: 'RequestError',
    code: 'ECONNREFUSED'
    }
    The credentials seem to be fine and the links seem to be fine
    Andrew Koltyakov
    @koltyakov
    Hey! ECONNREFUSED is when Node.js process can’t physically reach an address.
    Could be because of enterprise proxy for instance.
    Burnfireblaze
    @Burnfireblaze
    I have seen this, could this be an issue, and any way to resolve this?
    I am using Azure functions basically
    Burnfireblaze
    @Burnfireblaze
    Andrew any way to overcome this? I am unable to use sppull in serverless azure functions.

    sindresorhus/got#951

    This is an exact replication of the error

    Burnfireblaze
    @Burnfireblaze
    Ok Solved it was a simple issue
    Andrew Koltyakov
    @koltyakov
    What was it? Might be helpful for others if faced the same issue.
    Aboubakr LACHHAB
    @aboubakr.lachhab_gitlab
    Hi @Burnfireblaze ! I'm facing the same issue, it will be very helpful if you can share the solution.
    Brandt Spangenberg
    @Darkstar69er

    Hi,

    I'm currently trying to develop a electron/typescript application and very new to it.
    Reading through the documentation of you package, it looks like I should be able to handle authentication and requests for on prem severs using 'User credentials through the http ntlm handshake', through this package called 'sp-jsom-node'.
    I noticed the minimal setup section for typescript and made a few alterations. See test code below.

    const authOptions: IAuthOptions = {
      username: 'JohnDoe',
      password: 'S3cureP@ss',
      domain: 'myDomainName'
    };
    
    const authContext: IJsomNodeContext = {
      siteUrl: siteUrl, 
      authOptions: authOptions,
      modules: [ 'core' ], 
      envCode: '2016' 
    };
    
    const ctx = new JsomNode().init(authContext).getContext();
    const oWeb = ctx.get_web();
    const oLists = oWeb.get_lists();
    console.log(oLists);

    I get a error from 'new JsomNode()' within electrons developer tool window that states:

    'Uncaught Error: Cannot find module 'net'
    at webpackEmptyContext (eval at ./node_modules/defaultable sync recursive (app.js:1157:1), <anonymous>:2:10)
    at Object.workaround_require (defaultable.js?6987:49:1)
    at require (defaultable.js?6987:77:1)
    at eval (server.js?663d:9:1)
    at defaulter (defaultable.js?6987:83:1)
    at defaultable (defaultable.js?6987:63:1)
    at good (defaultable.js?6987:174:1)
    at Object.eval (server.js?663d:5:1)
    at eval (server.js:242:30)
    at Object../node_modules/hbo-dnsd/server.js (chunk-vendors.js:3945:1)'.

    I suspect it has something to do with the fact that I'm using Typescript and there's a missing module for NET which might be used within JsomNode?
    I'm not too sure if the issue is with my implementation or just my lack of understanding.

    I'm basically trying to create a authenticated context without using the 'private.json' file and instead using direct user input to the application.

    Andrew Koltyakov
    @koltyakov

    Hey @Darkstar69er,

    JSOM/CSOM is an old API which sometimes is useful for the places where modern API doesn't work or have gaps. But in a usually not needed until you know a very specific case you'd can't managed with REST for example.
    It runs in Node.js environment. You can't run a Node.js code in browser.

    The error is not connected with TypeScript. The message you're getting is Webpack which can't bundle code for browser as it can't find Node.js 'net' and browser is not a server side JS environment.

    In Electron app you should route requests through Electron's backend to make it work.

    Brandt Spangenberg
    @Darkstar69er
    Hi @koltyakov, thank you! I appreciate the response and guidance.
    Fabrício Rocha
    @ffcro3

    Hi Guys, hope you're doing just fine.

    Can you assist me? What i'm missing?

    const listTitle = 'sites';
    
        const request = sprequest.create(credentials);
       let urlTest = 'url';
    
       request.requestDigest(urlTest)
       .then(digest => {
         return request.post(`${urlTest}/_api/web/lists/GetByTitle('${listTitle}')/items`, {
           headers: {
             'X-RequestDigest': digest,
             "content-type": "application/json;odata=verbose",
           },
           body: {
             __metadata: { 'type': `SP.Data.${listTitle}ListItem` },
             Title: 'Test'
           }
         });
       })
       .then((data) => {
         expect(data.statusCode).to.equal(201);
       })
       .catch((err) => {
         console.log(err.message);
       });

    it returns:

    Response code 400 (Bad Request)
    Boon
    @bpsimm

    Hi, I'm noob here. English not my mother tongue. So forgive me if I typo or grammar mistake.
    I am following the tutotial on this page with node.js method for OneDrive business to WebDav
    https://github.com/skleeschulte/basic-to-sharepoint-auth-http-proxy

    So far all npm command already install and apply; but my access to localhost:3000 is failed.

    The things to ask is, I'm totally clueless how to use node-sp-auth as authentication?
    I'm lost with:

    Create authentication headers and perform http request
    Is it a file? Where it should be save? and under what name?

    I don't have experience using node.js ; just pick it up few days ago when I discover the tutorial.

    Hopefully, you guys can answer me. The node.js is running on machine Synology DS916+ DSM7

    Burnfireblaze
    @Burnfireblaze
    @aboubakr.lachhab_gitlab @koltyakov I apologize for this very late response. It was due to the packages I was using, they had some disruption due to the internal modules being used by them. The 2 packages which have collision are snowflake-multisql & sppull, since they had this issue, I moved them to 2 separate functions, after which they were working. So to correct this don't import these 2 modules or such modules together, put them in separate functions or files.
    Burnfireblaze
    @Burnfireblaze
    Hi @koltyakov I have an issue in sppull, sometimes when i pull the files from the sharepoint site, and try to download it to the dlrootfolder specified, instead of downloading to that folder it creates an entire list of folders which follows the sharepoint folder structure and places the file there instead of the actual dlrootfolder path. This is the same code that works for some other files but not for some directories. Any idea what might be the issue here?
    Burnfireblaze
    @Burnfireblaze
    image.png
    Ideally it should be downloaded like this^
    Most of them are
    Burnfireblaze
    @Burnfireblaze
    image.png
    But some of them have these folders created then the file, even though they have the same code & dlrootfolder. Any idea why?
    Andrew Koltyakov
    @koltyakov
    Hey! Sppull recreates the folders structure in most of the cases intentionally and designed for mass download. For a single file scenario sp-download (https://github.com/koltyakov/sp-download) might suit better. Regarding your case, it’s probably a special character in a path. Could you please create an issue in the repo with paths samples so I could take a look and try to repro?
    Burnfireblaze
    @Burnfireblaze
    Hi Andrew, yes I will create an issue
    But you see I cannot use sp-download as this is typescript
    Then I would need to change all of my imports in nodejs
    If you have any way of importing this module using require then we can try using that
    Andrew Koltyakov
    @koltyakov
    There is no issues importing with CommonJS https://github.com/koltyakov/sp-download#minimal-setup-javascript
    Burnfireblaze
    @Burnfireblaze
    Oh that's good then, will try this. Also can we use the same context we use for sppull?
    const context = {
    siteUrl: "",
    creds: {
    username: "",
    password: "",
    online: true
    }
    };
    in sp-download as well?
    Andrew Koltyakov
    @koltyakov
    exactly, the auth layer is the same
    Burnfireblaze
    @Burnfireblaze
    awesome ok
    Burnfireblaze
    @Burnfireblaze
    Have an error Andrew if i used the same context, it gave me this error:
    Error: Error while resolving authentication class
    at Function.resolve
    at Object.getAuth
    Burnfireblaze
    @Burnfireblaze
    Ok I got it we shd not supply this context
    Simply the creds is eenough
    {
    username: "",
    password: "",
    online: true
    }
    Ghassan Dabak
    @GhassanDabak
    Hello everyone, I have been stuck in a problem for a while now, this lobby is my last hope
    Andrew Koltyakov
    @koltyakov
    Hey @GhassanDabak, could you please describe your case? No one could help until knows which to help with.
    Ghassan Dabak
    @GhassanDabak
    Hey @koltyakov
    I registered an application on azure AD, i was able to integrate my nodejs application with sharepoint, upload files and creating folders using postman, the thing is that the access token expires after 75minutes, I have the refresh token which expires in 90days
    Ghassan Dabak
    @GhassanDabak
    Im seeking a way to be implemented dynamically in my app, in case of lack information, i am using my app to upload files/delete files/create folders through REST API, and i am happy to share any further details, thank you in advance
    Ghassan Dabak
    @GhassanDabak
    I got stuck in a situation where i can get the x-requestdigest through postman api, but im unable to do that using the code with the same headers and token as the postman
    JRedGoodroad
    @JRedGoodroad
    image.png

    Hey @koltyakov , I am using SPPull to download some folders/files from Sharepoint Online, but it's not actually finding/downloading anything.

    The weird thing is I'm not getting any error, which makes me think my cred or sites are incorrect. But the node-sp-auth-troubleshoot tool says my creds are good and when I go to the siteUrl/spRootFolder manually I get directed to the correct place. I feel like I've run out of options here so any assistance you could provide would be greatly appreciated.