Migration Guide: From V1 to V2
This guide explains the process of migrating your LivePerson Functions from V1 to V2 and the changes required to adapt your functions to the new, modern runtime.
The Automatic Migration Process
As part of LivePerson's migration to the Google Cloud Platform (GCP), your existing V1 functions are automatically migrated to V2 by LivePerson. Here’s what you need to know about this process.
Function States After Migration
Your functions are imported into the V2 environment and will be in a Frozen State, also called Compat State:
Functions in this Frozen state can not be modified, but can be deployed/undeployed if wanted. The runtime of those functions mirrors the environment of the V1 runtime ensuring the functions continue to operate as expected. However, because the environment is not 100% identical it can come to smaller changes in behaviour. To make changes, you must manually adapt it to the V2 standard as outlined in the Getting from V1 to V2 section.
Safety Net: Reverting to V1 If you encounter issues, you can revert a function to its previous V1 state. This provides a safety net to return to a known working version. To minimize risk, we strongly recommend testing any updates by creating a new V2 function rather than modifying a migrated one directly.
Deployed vs. Draft States
The deployed state of your functions is preserved during migration. Deployed functions remain deployed, and draft functions remain drafts.
Important Note on Modified Functions If a function is in a modified state (meaning you have saved changes that have not been deployed), the last deployed (productive) version is what gets migrated, not the current draft.
Getting from V1 to V2
To edit a frozen function or to take full advantage of the new V2 runtime, you need to manually update your code. Here are the key changes:
-
Node.js 22 Runtime: The new runtime uses Node.js 22, which includes the
fetchAPI by default. As a result, theHTTPClientfrom the toolbelt is deprecated. -
OAuth 2.0 and
LpClient:LpClientnow uses a more secure OAuth 2.0 authentication method, which is automatically provisioned. Some LivePerson APIs may require code changes on your end to work with OAuth 2.0.- For more details, see our guide on Migrating to OAuth2.
-
JSON Handling: The
json: trueoption is no longer supported for automatic JSON parsing. You must now manually set theContent-Type: application/jsonheader and useawait response.json()to parse the response body. -
ESM over CommonJS: The runtime now uses ES Modules (ESM). You must use
importandexportsyntax instead ofrequireandmodule.exports. -
Toolbelt Renamed: The toolbelt library has been renamed from
lp-faas-toolbelttocore-functions-toolbelt. -
Dynamic Domain Lookup: Hardcoding API domains is discouraged. Use the new CSDS Client in the toolbelt to look up domains dynamically.
-
Simplified Lambda Interface: The function signature is now
async function lambda(input). Callbacks are no longer needed. Simplyreturna value for a successful execution orthrowan error to fail. -
Strict Timeout Enforcement: Previously the execution time was not enforced strictly for background activities like
setTimeoutor code that ran async after the function returned a response. This will no longer work in V2 and may cause cryptic errors. Hence make sure to revisit your code to ensure no code is executed after it responded.
Deprecations
Here a list of things that are no longer supported or will lose support over time.
Deprecated App Keys The secrets
lp-faas-default-app-keyandlp-faas-orchestrator-app-keyare deprecated and should not be used. The V2 toolbelt works exclusively with OAuth 2.0. Continued use of these keys is at your own risk. For more details, see our guide on Migrating to OAuth2.
CRMClient is now deprecated in favor of using
jsforcedirectly. The Toolbelt functionConnectToSalesforcewill be removed in the future.
Changed Environment Variables
The following environment variables have been renamed:
| V1 Name | V2 Name |
|---|---|
BRAND_ID |
X_LIVEPERSON_BRAND_ID |
LAMBDA_UUID |
X_LIVEPERSON_FUNCTION_UUID |
CSDS_DOMAIN |
X_LIVEPERSON_CSDS_DOMAIN |
Changed Libraries
Several libraries have been upgraded or replaced. Review the linked migration guides for breaking changes.
-
lodash→es-toolkit:lodashhas been replaced byes-toolkit. A compatibility module is available ates-toolkit/compat. -
luxon1.x → 3.x: The date and time libraryluxonhas been upgraded. -
jsonwebtoken8.x → 9.x: The JWT library has been upgraded. Note that it no longer has a default export; use named imports likeimport { sign } from 'jsonwebtoken';. -
jsforce1.x →@jsforce/jsforce-node3.x:jsforcehas been upgraded to its smaller, Node.js-optimized package. - Official JSforce documentation
- JSforce v3 migration guide