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 fetch API by default. As a result, the HTTPClient from the toolbelt is deprecated.

  • OAuth 2.0 and LpClient: LpClient now 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.
  • JSON Handling: The json: true option is no longer supported for automatic JSON parsing. You must now manually set the Content-Type: application/json header and use await response.json() to parse the response body.

  • ESM over CommonJS: The runtime now uses ES Modules (ESM). You must use import and export syntax instead of require and module.exports.

  • Toolbelt Renamed: The toolbelt library has been renamed from lp-faas-toolbelt to core-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. Simply return a value for a successful execution or throw an error to fail.

  • Strict Timeout Enforcement: Previously the execution time was not enforced strictly for background activities like setTimeout or 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-key and lp-faas-orchestrator-app-key are 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 jsforce directly. The Toolbelt function ConnectToSalesforce will 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.