{"id":14440,"library":"aws-arn-parser","title":"AWS ARN Parser","description":"The `aws-arn-parser` package (version 1.0.1) offers a basic utility for parsing Amazon Resource Name (ARN) strings into a structured JavaScript object. It extracts common ARN components such as service, region, account ID, and resource identifier. The project's initial README explicitly stated it was in \"early days,\" indicating a lack of robust validation and potential for future structural changes. It is a simple, dependency-free parser primarily for Node.js environments. The package under this specific name appears to be effectively unmaintained or abandoned, with no discernible release cadence. Developers are advised to consider actively maintained and more robust alternatives, such as `@aws-sdk/util-arn-parser` from the official AWS SDK, or potentially the re-scoped `@sandfox/arn` by the same author, which provides TypeScript support and a revised output structure.","status":"abandoned","version":"1.0.1","language":"javascript","source_language":"en","source_url":"git://github.com/sandfox/aws-arn-parser#v1","tags":["javascript","amazon","aws","parser","arn"],"install":[{"cmd":"npm install aws-arn-parser","lang":"bash","label":"npm"},{"cmd":"yarn add aws-arn-parser","lang":"bash","label":"yarn"},{"cmd":"pnpm add aws-arn-parser","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"This package primarily supports CommonJS `require()` syntax. Direct ESM `import` will fail without a transpiler or ESM wrapper.","wrong":"import parser from 'aws-arn-parser';","symbol":"parser","correct":"const parser = require('aws-arn-parser');"}],"quickstart":{"code":"const parser = require('aws-arn-parser');\n\n// Example IAM Server Certificate ARN\nconst myAwsString = \"arn:aws:iam::123456789012:server-certificate/division_abc/subdivision_xyz/ProdServerCert\";\n\nconst arn = parser(myAwsString);\n\nconsole.log(arn);\n/* Expected output for v1.0.1:\n{\n  arn: 'arn',\n  aws: 'aws',\n  service: 'iam',\n  region: '',\n  namespace: '123456789012',\n  relativeId: 'server-certificate/division_abc/subdivision_xyz/ProdServerCert'\n}\n*/\n\n// Example S3 Bucket ARN with no region/account\nconst s3ArnString = \"arn:aws:s3:::my_bucket/path/to/object\";\nconst s3Arn = parser(s3ArnString);\nconsole.log(s3Arn);\n/* Expected output for v1.0.1:\n{\n  arn: 'arn',\n  aws: 'aws',\n  service: 's3',\n  region: '',\n  namespace: '',\n  relativeId: 'my_bucket/path/to/object'\n}\n*/","lang":"javascript","description":"This quickstart demonstrates how to use the `aws-arn-parser` package to parse two different types of AWS ARN strings into their constituent parts, printing the resulting object."},"warnings":[{"fix":"Migrate to a maintained ARN parser such as `@aws-sdk/util-arn-parser` from the official AWS SDK v3, or `@sandfox/arn` if its API matches your needs.","message":"The `aws-arn-parser` package (specifically version 1.0.1 and likely all versions under this name) is effectively abandoned. Its author may have transitioned to `@sandfox/arn`, but this specific package is no longer actively maintained. Users should migrate to actively supported alternatives.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Implement custom validation logic before passing strings to the parser, or use a more robust ARN parsing library that includes validation.","message":"This parser does not perform any validation on the input ARN string. It will attempt to parse any string provided, potentially leading to incorrect or unexpected output for malformed ARNs without throwing an error.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Be aware of the specific output structure and adapt your code accordingly. If migrating to a newer parser, expect to update how you access ARN components.","message":"The output object structure of `aws-arn-parser` (v1.0.x) differs significantly from newer or alternative ARN parsers (e.g., `@sandfox/arn` or `@aws-sdk/util-arn-parser`). Specifically, it uses fields like `namespace` and `relativeId` instead of `accountID` and `resource` or `resourcePart`.","severity":"breaking","affected_versions":">=1.0.0"}],"env_vars":null,"last_verified":"2026-04-19T00:00:00.000Z","next_check":"2026-07-18T00:00:00.000Z","problems":[{"fix":"Ensure you are using the correct CommonJS `require` syntax for a default function export: `const parser = require('aws-arn-parser');`","cause":"Attempting to import `aws-arn-parser` as a named export or using ESM `import` syntax in a CommonJS environment without a transpiler, where the package only exports a default function via `module.exports`.","error":"TypeError: parser is not a function"},{"fix":"Refer to the `aws-arn-parser` v1.0.1 documentation for its specific output format. If you need the newer structure, migrate to the corresponding package.","cause":"You are using `aws-arn-parser` (an older package) but expecting the output structure from a different, newer ARN parser (e.g., `@sandfox/arn` or `@aws-sdk/util-arn-parser`).","error":"ARN parsing yields unexpected output fields (e.g., 'namespace' instead of 'accountID')"}],"ecosystem":"npm"}