{"id":22667194,"url":"https://github.com/shereef/nestjs-swagger-serverless-layers-datadog-issue","last_synced_at":"2025-10-16T18:07:23.058Z","repository":{"id":139189732,"uuid":"574778616","full_name":"Shereef/nestjs-swagger-serverless-layers-datadog-issue","owner":"Shereef","description":"Weird issue preventing breaking lambda when using @nestjs/swagger + serverless-layers + serverless-plugin-datadog","archived":false,"fork":false,"pushed_at":"2023-04-07T20:47:35.000Z","size":1573,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-29T10:24:56.477Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Shereef.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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}},"created_at":"2022-12-06T03:42:36.000Z","updated_at":"2022-12-06T03:42:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"cecd8aca-87c4-4ded-9af2-385e12173553","html_url":"https://github.com/Shereef/nestjs-swagger-serverless-layers-datadog-issue","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Shereef/nestjs-swagger-serverless-layers-datadog-issue","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shereef%2Fnestjs-swagger-serverless-layers-datadog-issue","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shereef%2Fnestjs-swagger-serverless-layers-datadog-issue/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shereef%2Fnestjs-swagger-serverless-layers-datadog-issue/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shereef%2Fnestjs-swagger-serverless-layers-datadog-issue/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Shereef","download_url":"https://codeload.github.com/Shereef/nestjs-swagger-serverless-layers-datadog-issue/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Shereef%2Fnestjs-swagger-serverless-layers-datadog-issue/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261289020,"owners_count":23136045,"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":[],"created_at":"2024-12-09T14:40:13.413Z","updated_at":"2025-10-16T18:07:18.025Z","avatar_url":"https://github.com/Shereef.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"In this repo I am trying to explain that when the following is installed and enabled the project doesn't work when deployed to aws lambda\n\n1. [serverless-layers](https://github.com/agutoli/serverless-layers)\n2. [serverless-plugin-datadog](https://github.com/DataDog/serverless-plugin-datadog)\n3. [@nestjs/swagger](https://github.com/nestjs/swagger)\n\nif you disable any of them everything works fine (except the disabled protion ofc)\n\nTo test this out\n\n1. Add `DATADOG_API_KEY` env var with your datadog env vars\n2. Add AWS key id and secret to your env vars `AWS_ACCESS_KEY_ID` \u0026 `AWS_SECRET_ACCESS_KEY`\n3. run `npm i`\n4. run `npx serverless deploy --verbose`\n5. visit the url from the console output\n\nIt should display swagger but it doesn't instead `{\"message\": \"Internal server error\"}`\n\nsee bottom for full output\n\nif you append `/v1` to the url it should show `Hello World!` but it doesn't\n\ni.e. https://qwerty.execute-api.us-east-2.amazonaws.com/dev/ should show swagger\ni.e. https://qwerty.execute-api.us-east-2.amazonaws.com/dev/v1 should show `Hello World!`\n\nThe three above combined break the lambda function\n\nP.S. if you switch to any of the following branches the project works as expected\n\n1. `disable-serverless-layers-works` [preview changes](https://github.com/Shereef/nestjs-swagger-serverless-layers-datadog-issue/compare/main...disable-serverless-layers-works)\n2. `disable-datadog-works` [preview changes](https://github.com/Shereef/nestjs-swagger-serverless-layers-datadog-issue/compare/main...disable-datadog-works)\n3. `disable-swagger-works` [preview changes](https://github.com/Shereef/nestjs-swagger-serverless-layers-datadog-issue/compare/main...disable-swagger-works)\n\n```\nTest Event Name\nroot\n\nResponse\n{\n  \"errorType\": \"TypeError\",\n  \"errorMessage\": \"pathToRegexp.parse is not a function or its return value is not iterable\",\n  \"trace\": [\n    \"TypeError: pathToRegexp.parse is not a function or its return value is not iterable\",\n    \"    at SwaggerExplorer.validateRoutePath (/opt/nodejs/node_modules/@nestjs/swagger/dist/swagger-explorer.js:156:41)\",\n    \"    at /opt/nodejs/node_modules/@nestjs/swagger/dist/swagger-explorer.js:136:35\",\n    \"    at Array.map (\u003canonymous\u003e)\",\n    \"    at SwaggerExplorer.exploreRoutePathAndMethod (/opt/nodejs/node_modules/@nestjs/swagger/dist/swagger-explorer.js:135:30)\",\n    \"    at /opt/nodejs/node_modules/@nestjs/swagger/dist/swagger-explorer.js:72:45\",\n    \"    at Array.reduce (\u003canonymous\u003e)\",\n    \"    at /opt/nodejs/node_modules/@nestjs/swagger/dist/swagger-explorer.js:71:104\",\n    \"    at /opt/nodejs/node_modules/lodash/lodash.js:13469:38\",\n    \"    at /opt/nodejs/node_modules/lodash/lodash.js:4967:15\",\n    \"    at baseForOwn (/opt/nodejs/node_modules/lodash/lodash.js:3032:24)\"\n  ]\n}\n\nFunction Logs\nSTART RequestId: d721794d-11ac-1234-a0ef-acc07be0df1e Version: $LATEST\n\u001b[32m[Nest] 15  - \u001b[39m12/06/2022, 4:10:59 AM \u001b[32m    LOG\u001b[39m \u001b[38;5;3m[NestFactory] \u001b[39m\u001b[32mStarting Nest application...\u001b[39m\u001b[38;5;3m +43001ms\u001b[39m\n\u001b[32m[Nest] 15  - \u001b[39m12/06/2022, 4:10:59 AM \u001b[32m    LOG\u001b[39m \u001b[38;5;3m[InstanceLoader] \u001b[39m\u001b[32mAppModule dependencies initialized\u001b[39m\u001b[38;5;3m +23ms\u001b[39m\n2022-12-06T04:11:00.034Z\td721794d-11ac-1234-a0ef-acc07be0df1e\tERROR\t[dd.trace_id=2179485768246681000 dd.span_id=4424661968803014230] Invoke Error \t{\"errorType\":\"TypeError\",\"errorMessage\":\"pathToRegexp.parse is not a function or its return value is not iterable\",\"stack\":[\"TypeError: pathToRegexp.parse is not a function or its return value is not iterable\",\"    at SwaggerExplorer.validateRoutePath (/opt/nodejs/node_modules/@nestjs/swagger/dist/swagger-explorer.js:156:41)\",\"    at /opt/nodejs/node_modules/@nestjs/swagger/dist/swagger-explorer.js:136:35\",\"    at Array.map (\u003canonymous\u003e)\",\"    at SwaggerExplorer.exploreRoutePathAndMethod (/opt/nodejs/node_modules/@nestjs/swagger/dist/swagger-explorer.js:135:30)\",\"    at /opt/nodejs/node_modules/@nestjs/swagger/dist/swagger-explorer.js:72:45\",\"    at Array.reduce (\u003canonymous\u003e)\",\"    at /opt/nodejs/node_modules/@nestjs/swagger/dist/swagger-explorer.js:71:104\",\"    at /opt/nodejs/node_modules/lodash/lodash.js:13469:38\",\"    at /opt/nodejs/node_modules/lodash/lodash.js:4967:15\",\"    at baseForOwn (/opt/nodejs/node_modules/lodash/lodash.js:3032:24)\"]}\n2022-12-06 04:11:00 UTC | DD_EXTENSION | ERROR | LogMessage.UnmarshalJSON: can't read the spans object\nEND RequestId: d721794d-11ac-1234-a0ef-acc07be0df1e\nREPORT RequestId: d721794d-11ac-1234-a0ef-acc07be0df1e\tDuration: 276.08 ms\tBilled Duration: 277 ms\tMemory Size: 1024 MB\tMax Memory Used: 175 MB\n\nRequest ID\nd721794d-11ac-1234-a0ef-acc07be0df1e\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshereef%2Fnestjs-swagger-serverless-layers-datadog-issue","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshereef%2Fnestjs-swagger-serverless-layers-datadog-issue","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshereef%2Fnestjs-swagger-serverless-layers-datadog-issue/lists"}