Title: Hapi: `route.method.toUpperCase is not a function` for routes registered with an array of methods · Issue #25481 · getsentry/sentry-javascript · GitHub
Open Graph Title: Hapi: `route.method.toUpperCase is not a function` for routes registered with an array of methods · Issue #25481 · getsentry/sentry-javascript
X Title: Hapi: `route.method.toUpperCase is not a function` for routes registered with an array of methods · Issue #25481 · getsentry/sentry-javascript
Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using the latest SDK release https://github.com/...
Open Graph Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
X Description: Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th...
Opengraph URL: https://github.com/getsentry/sentry-javascript/issues/25481
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Hapi: `route.method.toUpperCase is not a function` for routes registered with an array of methods","articleBody":"### Is there an existing issue for this?\n\n- [x] I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues\n- [x] I have reviewed the documentation https://docs.sentry.io/\n- [x] I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases\n\n### How do you use Sentry?\n\nSentry Saas (sentry.io)\n\n### Which SDK are you using?\n\n@sentry/node - hapi\n\n### SDK Version\n\n11.5.0; also present in 11.8.0\n\n### Framework Version\n\n_No response_\n\n### Link to Sentry event\n\n_No response_\n\n### Reproduction Example/SDK Setup\n\n_No response_\n\n### Steps to Reproduce\n\n\n`instrument.mjs`:\n\n```js\nimport * as Sentry from '@sentry/node';\nSentry.init({\n dsn: 'https://public@example.invalid/1',\n tracesSampleRate: 1,\n traceLifecycle: 'static',\n});\n```\n\n`server.mjs`:\n\n```js\nimport Hapi from '@hapi/hapi';\nconst server = Hapi.server({ port: 0 });\nserver.route({ method: ['GET', 'POST'], path: '/multi', handler: () => 'ok' });\nserver.route({ method: 'GET', path: '/single', handler: () => 'ok' });\nawait server.start();\nfor (const path of ['/single', '/multi']) {\n const res = await fetch(server.info.uri + path);\n console.log(path, res.status);\n}\nawait server.stop();\n```\n\nRun `node --import ./instrument.mjs server.mjs`\n\n### Expected Result\n\nBoth requests return 200.\n\n\n### Actual Result\n\n\n`/single` returns 200; `/multi` returns 500:\n\n```\nTypeError: route.method.toUpperCase is not a function\n at getRouteMetadata (@sentry/server-utils/src/integrations/hapi/hapi-utils.ts:132:73)\n at \u003canonymous> (@sentry/server-utils/src/integrations/hapi/hapi-utils.ts:202:24)\n at exports.Manager.execute (@hapi/hapi/lib/toolkit.js:57:29)\n at internals.handler (@hapi/hapi/lib/handler.js:46:48)\n ...\n```\n\nWith the default `traceLifecycle` (`'stream'`), both return 200.\n\n\n### Additional Context\n\nHapi accepts `method` as a string or an array of strings. `wrapRouteHandler` passes the route *config* given to `server.route()` to `getRouteMetadata`. For non-streamed spans, that builds the span name as `` `${route.method.toUpperCase()} ${route.path}` ``, which assumes a string. The streamed-span branch only uses `route.path`, which is why the default lifecycle is unaffected. Either way, the array also ends up in the `http.request.method` attribute.\n\nA possible fix: inside the wrapped handler, read the method from the request (`request.method`, which Hapi has already resolved to one lowercase method) rather than from the route config.\n\n\n### Priority\n\n_No response_","author":{"url":"https://github.com/joshkel","@type":"Person","name":"joshkel"},"datePublished":"2026-10-18T00:27:57Z","url":"https://github.com/getsentry/sentry-javascript/issues/25481"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322 |
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:57cf2679-e227-70db-aa67-106adf7a48c1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | A6A2:34DFBA:2B9D981:387D0C4:6B0415A3 |
| html-safe-nonce | c9be1cd88211f6e86599f8a43cb3831c32f9661a0e0b9e9ea42c111d55c81f8e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNkEyOjM0REZCQToyQjlEOTgxOjM4N0QwQzQ6NkIwNDE1QTMiLCJ2aXNpdG9yX2lkIjoiNzIzOTQyODE5NTM4NzQ0NjY5MSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 1ba9a960af6fc678c5321f0bcec861783a533d6d4fac5f391e1c1784136996a6 |
| hovercard-subject-tag | issue:5904605473 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-javascript/25481/issue_layout |
| twitter:image | https://opengraph.githubassets.com/fe4c3ccdbf54fe6ae9bc12dc6e924ef8c2bebd00fa6ffb9b5e0f86dd3d270f3a/getsentry/sentry-javascript/issues/25481 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/fe4c3ccdbf54fe6ae9bc12dc6e924ef8c2bebd00fa6ffb9b5e0f86dd3d270f3a/getsentry/sentry-javascript/issues/25481 |
| og:image:alt | Is there an existing issue for this? I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues I have reviewed the documentation https://docs.sentry.io/ I am using th... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | joshkel |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/getsentry/sentry-javascript git https://github.com/getsentry/sentry-javascript.git |
| octolytics-dimension-user_id | 1396951 |
| octolytics-dimension-user_login | getsentry |
| octolytics-dimension-repository_id | 3328572 |
| octolytics-dimension-repository_nwo | getsentry/sentry-javascript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 3328572 |
| octolytics-dimension-repository_network_root_nwo | getsentry/sentry-javascript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width