Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

langfuse-core

Package Overview
Dependencies
Maintainers
0
Versions
99
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

langfuse-core - npm Package Compare versions

Comparing version 3.21.0 to 3.22.0

57

lib/index.cjs.js

@@ -329,5 +329,47 @@ 'use strict';

}
function isLangfuseFetchHttpError(error) {
return typeof error === "object" && error.name === "LangfuseFetchHttpError";
}
function isLangfuseFetchNetworkError(error) {
return typeof error === "object" && error.name === "LangfuseFetchNetworkError";
}
function isLangfuseFetchError(err) {
return typeof err === "object" && (err.name === "LangfuseFetchHttpError" || err.name === "LangfuseFetchNetworkError");
return isLangfuseFetchHttpError(err) || isLangfuseFetchNetworkError(err);
}
// Constants for URLs
const SUPPORT_URL = "https://langfuse.com/support";
const API_DOCS_URL = "https://api.reference.langfuse.com";
const RBAC_DOCS_URL = "https://langfuse.com/docs/rbac";
const INSTALLATION_DOCS_URL = "https://langfuse.com/docs/sdk/typescript/guide";
const RATE_LIMITS_URL = "https://langfuse.com/faq/all/api-limits";
const NPM_PACKAGE_URL = "https://www.npmjs.com/package/langfuse";
// Error messages
const updatePromptResponse = `Make sure to keep your SDK updated, refer to ${NPM_PACKAGE_URL} for details.`;
const defaultServerErrorPrompt = `This is an unusual occurrence and we are monitoring it closely. For help, please contact support: ${SUPPORT_URL}.`;
const defaultErrorResponse = `Unexpected error occurred. Please check your request and contact support: ${SUPPORT_URL}.`;
// Error response map
const errorResponseByCode = new Map([
// Internal error category: 5xx errors, 404 error
[500, `Internal server error occurred. For help, please contact support: ${SUPPORT_URL}`], [501, `Not implemented. Please check your request and contact support for help: ${SUPPORT_URL}.`], [502, `Bad gateway. ${defaultServerErrorPrompt}`], [503, `Service unavailable. ${defaultServerErrorPrompt}`], [504, `Gateway timeout. ${defaultServerErrorPrompt}`], [404, `Internal error occurred. ${defaultServerErrorPrompt}`],
// Client error category: 4xx errors, excluding 404
[400, `Bad request. Please check your request for any missing or incorrect parameters. Refer to our API docs: ${API_DOCS_URL} for details.`], [401, `Unauthorized. Please check your public/private host settings. Refer to our installation and setup guide: ${INSTALLATION_DOCS_URL} for details on SDK configuration.`], [403, `Forbidden. Please check your access control settings. Refer to our RBAC docs: ${RBAC_DOCS_URL} for details.`], [429, `Rate limit exceeded. For more information on rate limits please see: ${RATE_LIMITS_URL}`]]);
// Returns a user-friendly error message based on the HTTP status code
function getErrorResponseByCode(code) {
if (!code) {
return `${defaultErrorResponse} ${updatePromptResponse}`;
}
const errorResponse = errorResponseByCode.get(code) || defaultErrorResponse;
return `${code}: ${errorResponse} ${updatePromptResponse}`;
}
function logIngestionError(error) {
if (isLangfuseFetchHttpError(error)) {
const code = error.response.status;
const errorResponse = getErrorResponseByCode(code);
console.error("[Langfuse SDK] Error while flushing Langfuse.", errorResponse, `Error details: ${error}`);
} else if (isLangfuseFetchNetworkError(error)) {
console.error("[Langfuse SDK] Network error while flushing Langfuse.", `Error details: ${error}`);
} else {
console.error("[Langfuse SDK] Unknown error while flushing Langfuse.", `Error details: ${error}`);
}
}
class LangfuseCoreStateless {

@@ -688,3 +730,3 @@ constructor(params) {

} catch (e) {
console.error(`Event Body for ${type} is not JSON-serializable: ${e}`);
console.error(`[Langfuse SDK] Event Body for ${type} is not JSON-serializable: ${e}`);
this._events.emit("error", `Event Body for ${type} is not JSON-serializable: ${e}`);

@@ -726,3 +768,3 @@ return;

if (err) {
console.error("Error while flushing Langfuse", err);
logIngestionError(err);
resolve();

@@ -733,4 +775,5 @@ } else {

});
// safeguard against unexpected synchronous errors
} catch (e) {
console.error("Error while flushing Langfuse", e);
console.error("[Langfuse SDK] Error while flushing Langfuse", e);
}

@@ -810,3 +853,3 @@ });

} catch (error) {
console.error(error);
console.error(`[Langfuse SDK] ${error}`);
remainingItems.push(...queue.slice(i));

@@ -897,3 +940,3 @@ break;

} catch (e) {
console.error("Error while shutting down Langfuse", e);
console.error("[Langfuse SDK] Error while shutting down Langfuse", e);
}

@@ -1175,3 +1218,3 @@ }

} catch (error) {
console.error(`Error while fetching prompt '${cacheKey}':`, error);
console.error(`[Langfuse SDK] Error while fetching prompt '${cacheKey}':`, error);
throw error;

@@ -1178,0 +1221,0 @@ }

4

package.json
{
"name": "langfuse-core",
"version": "3.21.0",
"version": "3.22.0",
"engines": {

@@ -40,3 +40,3 @@ "node": ">=18"

},
"gitHead": "e87857d5cf2ef9d02fe281d53d317a617850fc0f"
"gitHead": "473d223e0ac51ab41072406298cf28257b39438f"
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc