Registry / crm / force
library0.0.3jsnpmunverified

Node.js REST API wrapper for Salesforce (force.com, database.com, salesforce.com). Version 0.0.3, last published around 2012. This library is deprecated and unmaintained; users should migrate to nforce. It provides OAuth 2.0 flows, sObject CRUD operations, query support, and intelligent record update caching. No longer receives updates and has known issues with newer Salesforce API versions.

npm install force
INSTALL
IMPORT
SIG · FORCE
F
force
crmjavascriptv0.0.3
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.

default import
var force = require('force');
CommonJS only; no ESM or named exports.
createConnection
var org = force.createConnection({...});
const force = require('force').createConnection({...});
createConnection is a method on the default export, not a named export.
createSObject
var acc = force.createSObject('Account');
const { createSObject } = require('force');
createSObject is a method on the default export, not a named export.

Demonstrates creating a connection, authenticating with username/password, and inserting an sObject.

var force = require('force'); var org = force.createConnection({ clientId: process.env.SF_CLIENT_ID ?? '', clientSecret: process.env.SF_CLIENT_SECRET ?? '', redirectUri: 'http://localhost:3000/oauth/_callback', apiVersion: 'v27.0', environment: 'production', mode: 'multi' }); var oauth; org.authenticate({ username: process.env.SF_USER ?? '', password: process.env.SF_PASS ?? '' }, function(err, resp) { if (err) { console.error(err); return; } oauth = resp; var acc = force.createSObject('Account'); acc.Name = 'Test Account'; acc.Phone = '123-456-7890'; org.insert(acc, oauth, function(err, resp) { if (err) { console.error(err); return; } console.log('Account created with Id: ' + resp.id); }); });
Debug
Known issues
deprecatedThis library is deprecated. Please use nforce instead.
fix
Replace require('force') with require('nforce') and adjust API calls.
affects: *
gotchaOAuth token must be passed explicitly in multi-user mode; single-user mode caches it.
fix
For multi-user, always pass the oauth object as first argument after the record.
affects: *
breakingAPI version defaults may break with newer Salesforce API versions.
fix
Explicitly set apiVersion to a supported version like 'v52.0'.
affects: *
gotchaEnvironment must be 'production' or 'sandbox' – incorrect string leads to auth failure.
fix
Use either 'production' or 'sandbox' exactly.
affects: *
deprecatedThe package is no longer maintained; no security patches.
fix
Migrate to nforce or another maintained library.
affects: *
Errors
Common errors & fixes
Cannot find module 'force'
The package is not installed or npm install failed.
fix
Run: npm install force
Invalid Client Id
The clientId provided is incorrect or does not match the Salesforce app.
fix
Verify the client ID from your Salesforce Remote Access Application.
Authentication failed: UNKNOWN_EXCEPTION
Username/password flow with incorrect credentials or IP restrictions.
fix
Check username and password, ensure IP is whitelisted, or use Authorization Code flow.
Cannot read property 'access_token' of undefined
OAuth response is empty or authentication failed without calling callback with error.
fix
Check authentication callback for errors before accessing oauth properties.
Upgrade
Version history
0.0.3latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
22 hits · last 30 days
node
20
Resources
packageforce
force — npm install force · libregistry