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

posthog-node

Package Overview
Dependencies
Maintainers
5
Versions
67
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

posthog-node - npm Package Compare versions

Comparing version 1.1.5 to 1.1.6

36

feature-flags.js

@@ -8,2 +8,13 @@ const axios = require('axios')

class ClientError extends Error {
constructor(message, extra) {
super()
Error.captureStackTrace(this, this.constructor)
this.name = 'ClientError'
this.message = message
if (extra) {
this.extra = extra
}
}
}

@@ -76,12 +87,20 @@ class FeatureFlagsPoller {

const res = await this._request({ path: 'api/feature_flag', usePersonalApiKey: true })
try {
const res = await this._request({ path: 'api/feature_flag', usePersonalApiKey: true })
if (res && res.status === 401) {
throw new ClientError(
`Your personalApiKey is invalid. Are you sure you're not using your Project API key? More information: https://posthog.com/docs/api/overview`
)
}
if (res && res.status === 401) {
throw new Error(
`Your personalApiKey is invalid. Are you sure you're not using your Project API key? More information: https://posthog.com/docs/api/overview`
)
this.featureFlags = res.data.results.filter(flag => flag.active)
this.loadedSuccessfullyOnce = true
} catch (err) {
// if an error that is not an instance of ClientError is thrown
// we silently ignore the error when reloading feature flags
if (err instanceof ClientError) {
throw err
}
}
this.featureFlags = res.data.results.filter(flag => flag.active)
this.loadedSuccessfullyOnce = true
}

@@ -130,2 +149,3 @@

let res

@@ -132,0 +152,0 @@ try {

{
"name": "posthog-node",
"version": "1.1.5",
"version": "1.1.6",
"description": "PostHog Node.js integration",

@@ -5,0 +5,0 @@ "license": "MIT",

@@ -25,1 +25,2 @@ # PostHog Node.js Library

### [Join our Slack community.](https://posthog.com/slack)
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