{"id":19686664,"url":"https://github.com/tinovyatkin/smithy-node-native-fetch","last_synced_at":"2025-09-11T13:11:14.721Z","repository":{"id":214635201,"uuid":"736980555","full_name":"tinovyatkin/smithy-node-native-fetch","owner":"tinovyatkin","description":"Node.js 18+ optimized native fetch support for Smithy clients like AWS SDK v3","archived":false,"fork":false,"pushed_at":"2025-09-10T02:49:07.000Z","size":3250,"stargazers_count":2,"open_issues_count":7,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-10T05:55:14.960Z","etag":null,"topics":["aws","fetch","nodejs","smithy"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/tinovyatkin.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-12-29T12:48:01.000Z","updated_at":"2025-09-10T02:48:52.000Z","dependencies_parsed_at":"2024-03-30T15:28:33.735Z","dependency_job_id":"43578d14-0751-4c00-a7f9-de27f9b72a45","html_url":"https://github.com/tinovyatkin/smithy-node-native-fetch","commit_stats":null,"previous_names":["tinovyatkin/smithy-node-native-fetch"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/tinovyatkin/smithy-node-native-fetch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinovyatkin%2Fsmithy-node-native-fetch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinovyatkin%2Fsmithy-node-native-fetch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinovyatkin%2Fsmithy-node-native-fetch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinovyatkin%2Fsmithy-node-native-fetch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tinovyatkin","download_url":"https://codeload.github.com/tinovyatkin/smithy-node-native-fetch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tinovyatkin%2Fsmithy-node-native-fetch/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274640913,"owners_count":25322843,"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","status":"online","status_checked_at":"2025-09-11T02:00:13.660Z","response_time":74,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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","fetch","nodejs","smithy"],"created_at":"2024-11-11T18:29:43.196Z","updated_at":"2025-09-11T13:11:14.697Z","avatar_url":"https://github.com/tinovyatkin.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# smithy-node-native-fetch [![codecov](https://codecov.io/gh/tinovyatkin/smithy-node-native-fetch/graph/badge.svg?token=5SEnvZs5cV)](https://codecov.io/gh/tinovyatkin/smithy-node-native-fetch)\n\nNode.js 18+ optimized native fetch support for Smithy clients like AWS SDK v3\n\n## Why\n\nSmithy (and so AWS SDK) provides `fetch` request handler only for browsers with a lot of compatibility workarounds and yet it doesn't work in modern Node.js runtimes with native global `fetch` and web streams support.\n\nNode 18+ `fetch` is based on [undici](https://undici.nodejs.org/#/) which benchmarks as top performing HTTP/1.1 client for Node. In additional, using native `fetch` with AWS SDK allows to prepare to the moment when in Node.js `response.Body` may be a standard web stream also.\n\nThis handler also allows you to use modern request mocking tooling such as [msw 2.x](https://mswjs.io/) or [undici global dispatcher](https://undici.nodejs.org/#/docs/api/MockAgent) (see tests for this module).\n\n## Usage\n\nSimplest way with default settings (keepAlive is enabled and no timeout set) is as below:\n\n```ts\nimport { S3Client } from \"@aws-sdk/client-s3\";\nimport * as nodeNativeFetch from \"smithy-node-native-fetch\";\n\nconst s3 = new S3Client({\n  retryMode: \"adaptive\", // or whatever else settings\n  ...nodeNativeFetch,\n});\n```\n\nIf you want to customize settings then use specific imports:\n\n```ts\nimport { S3Client } from \"@aws-sdk/client-s3\";\nimport {\n  sdkStreamMixin,\n  streamCollector,\n  NodeNativeFetchHttpHandler,\n} from \"./fetch-http-handler\";\n\nconst s3 = new S3Client({\n  retryMode: \"adaptive\", // or whatever else settings\n  requestHandler: new NodeNativeFetchHttpHandler({\n    requestTimeout: 5000, // default is no timeout\n    keepAlive: true, // default is false\n  }),\n  sdkStreamMixin,\n  streamCollector,\n});\n```\n\n### Usage with CDK / Lambda\n\nThis modules also provides two small AWS CDK construct to simplify it's usage on AWS Lambda:\n\n- `SmithyNodeNativeFetchLayer` - deploys lambda layer with this module\n- `SmithyNodeNativeAspect` - an Aspect that deploys a singleton lambda layer and automatically add it to all supported lambda in a scope.\n\nUse is as below:\n\n```ts\nimport * as cdk from \"aws-cdk-lib\";\nimport { SmithyNodeNativeAspect } from \"smithy-node-native-fetch/cdk\";\n\nconst app = new cdk.App();\ncdk.Aspects.of(app).add(new SmithyNodeNativeAspect());\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinovyatkin%2Fsmithy-node-native-fetch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftinovyatkin%2Fsmithy-node-native-fetch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftinovyatkin%2Fsmithy-node-native-fetch/lists"}