{"id":23330437,"url":"https://github.com/iopipe/iopipe-js","last_synced_at":"2025-08-23T00:31:04.972Z","repository":{"id":28639536,"uuid":"109193953","full_name":"iopipe/iopipe-js","owner":"iopipe","description":"Build and run serverless apps with confidence on AWS Lambda with Tracing, Profiling, Metrics, Monitoring, and more.","archived":false,"fork":false,"pushed_at":"2022-12-09T01:31:35.000Z","size":1224,"stargazers_count":33,"open_issues_count":22,"forks_count":10,"subscribers_count":3,"default_branch":"master","last_synced_at":"2024-12-05T23:47:26.517Z","etag":null,"topics":["aws","aws-lambda","aws-lambda-node","debugging","iopipe","iopipe-agent","profiling","serverless","serverless-functions","tracing"],"latest_commit_sha":null,"homepage":"https://www.iopipe.com","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iopipe.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-11-01T23:13:40.000Z","updated_at":"2021-09-06T10:10:41.000Z","dependencies_parsed_at":"2022-08-07T14:00:27.850Z","dependency_job_id":null,"html_url":"https://github.com/iopipe/iopipe-js","commit_stats":null,"previous_names":[],"tags_count":25,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iopipe%2Fiopipe-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iopipe%2Fiopipe-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iopipe%2Fiopipe-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iopipe%2Fiopipe-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iopipe","download_url":"https://codeload.github.com/iopipe/iopipe-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":230650672,"owners_count":18259299,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","aws-lambda","aws-lambda-node","debugging","iopipe","iopipe-agent","profiling","serverless","serverless-functions","tracing"],"created_at":"2024-12-20T22:18:04.255Z","updated_at":"2024-12-20T22:18:04.862Z","avatar_url":"https://github.com/iopipe.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"**✨Special Announcement: We've Joined New Relic Serverless!**\n**Get ready to function faster with full visibility into your serverless applications—and everything else. [Read our founders' note to learn more.](https://read.iopipe.com/founders-note-iopipe-new-relic-acquisition-c15eeda47151)**\n\nIOpipe Agent \u0026 Bundled Plugins\n-----------------------------\n\n[![npm version](https://badge.fury.io/js/%40iopipe%2Fiopipe.svg)](https://badge.fury.io/js/%40iopipe%2Fiopipe)\n[![Slack](https://img.shields.io/badge/chat-slack-ff69b4.svg)](https://iopipe.now.sh/)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n\nThis package provides the IOpipe agent and plugins pre-bundled.\n\n# Installation \u0026 usage\n\nInstall via npm:\n\n```bash\nnpm install --save @iopipe/iopipe\n```\n\nOr via yarn:\n\n```bash\nyarn add @iopipe/iopipe\n```\n\nThen require this module, passing it an object with your project token ([get a free account](https://www.iopipe.com)), and it will automatically monitor and collect metrics from your applications running on AWS Lambda.\n\nIf you are using the Serverless Framework to deploy your lambdas, check out our [serverless plugin](https://github.com/iopipe/serverless-iopipe-layers).\n\nExample:\n\n```js\nconst iopipe = require('@iopipe/iopipe')({ token: 'PROJECT_TOKEN' });\n\nexports.handler = iopipe((event, context) =\u003e {\n  context.succeed('This is my serverless function!');\n});\n```\n\nBy default this package will enable `@iopipe/trace` and `@iopipe/event-info` plugins. It also includes the `@iopipe/profiler` plugin, which is disabled by default. For more information on how to use IOpipe and these plugins, see the documentation below:\n\n- [IOpipe Documentation](https://github.com/iopipe/iopipe-js-core#readme)\n- [IOpipe Tracing Plugin Documentation](https://github.com/iopipe/iopipe-plugin-trace#readme)\n- [IOpipe Event Info Plugin Documentation](https://github.com/iopipe/iopipe-js-event-info#readme)\n- [IOpipe Profiler Plugin Documentation](https://github.com/iopipe/iopipe-plugin-profiler#readme)\n\nExample With Tracing, Custom Metrics, and Labels (ES6 Module Format):\n\n```js\nimport iopipe, {mark, metric, label} from '@iopipe/iopipe';\n\nexports.handler = iopipe()(async (event, context) =\u003e {\n  // add a trace measurement for the database call\n  mark.start('db-call');\n  // fetch some data from the database\n  const rows = await sql(`select * from dogs where status = 'goodboy'`);\n  mark.end('db-call');\n\n  // add a custom metric for IOpipe search and alerts\n  metric('rows-from-db', rows.length);\n\n  // add a label to this invocation for easy filter/sort on dashboard.iopipe.com\n  label('used-db-cache');\n\n  context.succeed('This is my serverless function!');\n});\n```\n\n# Lambda Layers\n\nIOpipe publishes [AWS Lambda Layers](https://docs.aws.amazon.com/lambda/latest/dg/configuration-layers.html) which are publicly available on AWS. Using a framework that supports lambda layers (such as SAM or Serverless), you can use the following ARNs for your runtime:\n\n* nodejs10.x: `arn:aws:lambda:$REGION:146318645305:layer:IOpipeNodeJS10:$VERSION_NUMBER`\n* nodejs8.10: `arn:aws:lambda:$REGION:146318645305:layer:IOpipeNodeJS810:$VERSION_NUMBER`\n\nWhere `$REGION` is your AWS region and `$VERSION_NUMBER` is an integer representing the IOpipe release. You can get the version number via the [Releases](https://github.com/iopipe/iopipe-js/releases) page.\n\nThen in your SAM template (for example), you can add:\n\n```yaml\nGlobals:\n  Function:\n    Layers:\n        - arn:aws:lambda:us-east-1:146318645305:layer:IOpipeNodeJS810:1\n```\n\nAnd the IOpipe library will be included in your function automatically.\n\nYou can also wrap your IOpipe functions without a code change using layers. For example, in your SAM template you can do the following:\n\n```yaml\nResources:\n  YourFunctionHere:\n    Type: 'AWS::Serverless::Function'\n    Properties:\n      CodeUri: path/to/your/code\n      # Automatically wraps the handler with IOpipe\n      Handler: @iopipe/iopipe.handler\n      Runtime: nodejs8.10\n      Environment:\n        Variables:\n          # Specifies which handler IOpipe should run\n          IOPIPE_HANDLER: path/to/your.handler\n```\n\nOr with the Serverless framework:\n\n```yaml\nfunctions:\n  your-function-here:\n    environment:\n        IOPIPE_HANDLER: path/to/your.handler\n    handler: @iopipe/iopipe.handler\n    layers:\n      - arn:aws:lambda:us-east-1:146318645305:layer:IOpipeNodeJS810:1\n    runtime: nodejs8.10\n```\n# Troubleshooting\n\n## Lambda layers: ```Lambda can't find the file @iopipe/iopipe.js```\n\nIf you're seeing this error, it's likely that the node runtime isn't resolving ```NPM_PATH``` for the ```@iopipe/iopipe``` module in ```/opt/nodejs/node_modules```.\n\nThese steps should fix the problem:  \n1. Create an ```iopipe_wrapper.js``` script in your project's root.\n2. The script's contents should be ```module.exports = require('@iopipe/iopipe');```. (And that's all that needs to be in it.)\n3. Update the handler for your layer declaration to ```iopipe_wrapper.handler```.\n\n# License\n\nApache 2.0\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiopipe%2Fiopipe-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiopipe%2Fiopipe-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiopipe%2Fiopipe-js/lists"}