{"id":46973,"library":"appinsights-rest","title":"appinsights-rest","description":"A lightweight, framework-independent Application Insights REST API client for Node.js, optimized for Nuxt 4 and modern frameworks. Version 0.2.3 is current (released intermittently on GitHub). It supports full telemetry (events, requests, dependencies, exceptions, traces, metrics) with automatic batching and retry, zero core dependencies, and TypeScript types. Unlike the official @microsoft/applicationinsights-web SDK, this focuses on server-side telemetry with a simple synchronous API queued for batch delivery.","status":"active","version":"0.2.3","language":"javascript","source_language":"en","source_url":"https://github.com/mizukoshi-yuki/appinsights-rest","tags":["javascript","application-insights","azure","telemetry","nuxt","nuxt4","monitoring","rest-api","typescript"],"install":[{"cmd":"npm install appinsights-rest","lang":"bash","label":"npm"},{"cmd":"yarn add appinsights-rest","lang":"bash","label":"yarn"},{"cmd":"pnpm add appinsights-rest","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Optional Nuxt 4 module integration","package":"nuxt","optional":true}],"imports":[{"note":"CommonJS require will not work as package is ESM-only.","wrong":"const AppInsightsLogger = require('appinsights-rest')","symbol":"AppInsightsLogger","correct":"import { AppInsightsLogger } from 'appinsights-rest'"},{"note":"Use 'import type' for TypeScript interfaces to avoid runtime import.","wrong":"import { AppInsightsConfig } from 'appinsights-rest'","symbol":"AppInsightsConfig","correct":"import type { AppInsightsConfig } from 'appinsights-rest'"},{"note":"Type-only import for request tracking options.","wrong":null,"symbol":"RequestTelemetry","correct":"import type { RequestTelemetry } from 'appinsights-rest'"}],"quickstart":{"code":"import { AppInsightsLogger } from 'appinsights-rest'\n\nconst logger = new AppInsightsLogger({\n  connectionString: process.env.APPLICATIONINSIGHTS_CONNECTION_STRING ?? '',\n  role: 'my-app',\n  appVersion: '1.0.0'\n})\n\nlogger.trackEvent('user_login', { userId: '123', method: 'oauth' })\n\nconst requestId = logger.trackRequest({\n  name: 'GET /api/users',\n  url: 'https://example.com/api/users',\n  duration: 150,\n  responseCode: 200,\n  success: true\n})\n\ntry {\n  throw new Error('test error')\n} catch (error) {\n  logger.trackException(error, { context: 'user_registration' })\n}\n\nawait logger.dispose()","lang":"typescript","description":"Shows how to initialize AppInsightsLogger with connection string, track events, requests, exceptions, and clean up with dispose."},"warnings":[{"fix":"Use 'import' syntax or dynamic import. For CommonJS projects, set type: module or use .mjs extension.","message":"ESM-only package: 'require' will throw Module is not defined.","severity":"breaking","affected_versions":">=0.1.0"},{"fix":"Call await logger.dispose() or logger.flush() (if exposed) to ensure all queued telemetry is sent before process exit.","message":"Tracking methods are synchronous and queue telemetry; they do not send immediately.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Always set APPLICATIONINSIGHTS_CONNECTION_STRING environment variable or pass connectionString to constructor.","message":"Connection string is required; missing it will cause runtime error on first flush.","severity":"gotcha","affected_versions":">=0.1.0"},{"fix":"Replace correlationId with operationId in RequestTelemetry options.","message":"The 'correlationId' option in trackRequest is deprecated in v0.2.0; use 'operationId' instead.","severity":"deprecated","affected_versions":">=0.2.0"},{"fix":"Upgrade to Nuxt 4 or use the framework-independent core without Nuxt module.","message":"Nuxt integration requires Nuxt 4.0.0 or higher; older Nuxt versions are not supported.","severity":"gotcha","affected_versions":">=0.1.0"}],"env_vars":null,"search_vec":"'0.2.3':24 '4':19 'api':12,68,84 'appinsight':2 'appinsights-rest':1 'applic':9,75 'application-insight':74 'automat':42 'azur':77 'batch':43,71 'client':13 'core':47 'current':26 'deliveri':72 'depend':37,48 'event':35 'except':38 'focus':58 'framework':7,22 'framework-independ':6 'full':33 'github':30 'independ':8 'insight':10,76 'intermitt':28 'javascript':73 'lightweight':5 'metric':40 'microsoft/applicationinsights-web':55 'modern':21 'monitor':81 'node.js':15 'nuxt':18,79 'nuxt4':80 'offici':54 'optim':16 'queu':69 'releas':27 'request':36 'rest':3,11,83 'rest-api':82 'retri':45 'sdk':56 'server':61 'server-sid':60 'side':62 'simpl':66 'support':32 'synchron':67 'telemetri':34,63,78 'trace':39 'type':51 'typescript':50,85 'unlik':52 'version':23 'zero':46","created_at":"2026-06-07T16:49:06.690895+00:00","updated_at":"2026-06-07T16:49:06.690895+00:00","problems":[{"fix":"Change require to import: import { AppInsightsLogger } from 'appinsights-rest'","cause":"Using CommonJS require with an ESM-only package.","error":"TypeError: appinsights_rest_1.AppInsightsLogger is not a constructor"},{"fix":"Set env variable or pass connectionString: process.env.APPLICATIONINSIGHTS_CONNECTION_STRING ?? ''","cause":"No connection string provided to constructor or environment variable.","error":"Error: Missing connection string. Set APPLICATIONINSIGHTS_CONNECTION_STRING or pass connectionString option."},{"fix":"Run npm install appinsights-rest and ensure import path is correct.","cause":"Package not installed or incorrect import path.","error":"ERR_MODULE_NOT_FOUND: Cannot find module 'appinsights-rest'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/mizukoshi-yuki/appinsights-rest#readme","github":"https://github.com/mizukoshi-yuki/appinsights-rest","docs":null,"changelog":null,"pypi":null,"npm":"appinsights-rest","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops","analytics"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}