Registry / devops / sp-rest-proxy

sp-rest-proxy

JSON →
library3.3.6jsnpmunverified

SharePoint REST API Proxy for Node.js and Express local serve. Current stable version is 3.3.6. Release cadence is moderate with periodic updates. Key differentiators: supports SharePoint Online and On-Prem (2019, 2016, 2013, limited 2010), proxies REST API, CSOM, SOAP, and custom services, offers multiple modes (API proxy, socket gateway server, socket gateway client, custom Express embed). Ships TypeScript types. Commonly used with SPFx and PnP JS for local development against real SharePoint data.

npm install sp-rest-proxy
INSTALL
IMPORT
SIG · SP-REST-PROXY
S
sp-rest-proxy
devopsjavascriptv3.3.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

RestProxy
const { RestProxy } = require('sp-rest-proxy');
const RestProxy = require('sp-rest-proxy');
CommonJS require with destructuring (named export). ESM not typically used; TypeScript: import { RestProxy } from 'sp-rest-proxy';
RestProxy
import { RestProxy } from 'sp-rest-proxy';
import RestProxy from 'sp-rest-proxy';
Named export, not default. Works with TypeScript and ESM settings.
IRestProxySettings
import { IRestProxySettings } from 'sp-rest-proxy';
TypeScript type import for settings object.
IRestProxyOptions
import { IRestProxyOptions } from 'sp-rest-proxy';
Another TypeScript type for proxy options.

Creates a local Express server that proxies SharePoint REST API calls to a remote instance using configuration from private.json.

const { RestProxy } = require('sp-rest-proxy'); const settings = { configPath: './config/private.json', port: 8080, staticRoot: './static' }; const restProxy = new RestProxy(settings); restProxy.serve();
Debug
Known issues
breakingv3.0.0 changed authentication strategy: removed node-sp-auth-config dependency, now uses sp-request and node-sp-auth directly. Existing private.json may need update.
fix
Update private.json format per documentation; use sp-request for auth.
affects: >=3.0.0 <4.0.0
deprecatedv2.x is deprecated; upgrade to v3.x for continued support.
fix
Update to v3.x via npm install sp-rest-proxy@latest
affects: >=2.0.0 <3.0.0
gotchaIf using socket gateway mode, ensure client and server versions match exactly to avoid protocol incompatibility.
fix
Keep sp-rest-proxy version consistent across gateway servers and clients.
affects: >=2.0.0
Errors
Common errors & fixes
Cannot find module 'sp-rest-proxy'
Package not installed or incorrect require path.
fix
Run 'npm install sp-rest-proxy' and ensure import uses 'const { RestProxy } = require('sp-rest-proxy')'
Error: SharePoint authentication failed
Incorrect credentials in private.json or expired OAuth token.
fix
Verify configPath and credentials. For Online, reauthenticate via device login.
Error: listen EADDRINUSE :::8080
Port 8080 already in use by another process.
fix
Change settings.port to an available port (e.g., 8081) or kill the process using the port.
Upgrade
Version history
3.3.6latest on npm
Audit
Dependencies
expressrequiredHTTP server framework
sp-requestrequiredSharePoint authentication and requests
node-sp-authrequiredSharePoint authentication strategies
Agent activity
6 hits · last 30 days
node
4
Amazon
1
Resources
sp-rest-proxy — npm install sp-rest-proxy · libregistry