Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: access handler name add properties to req route options #4470

Conversation

cesarvspr
Copy link
Contributor

@cesarvspr cesarvspr commented Dec 17, 2022

Closes #4439

Checklist

@cesarvspr cesarvspr changed the title (#4439) access handler name add properties to req route options (#4439) access handler name add properties to req route options (WIP) Dec 17, 2022
@cesarvspr cesarvspr marked this pull request as draft December 17, 2022 20:50
Copy link
Member

@Eomm Eomm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The request.routeOptions should be immutable test is failing, it could be due to the new warning

lib/request.js Outdated Show resolved Hide resolved
cesarvspr and others added 2 commits December 19, 2022 16:59
Co-authored-by: Manuel Spigolon <behemoth89@gmail.com>
Signed-off-by: cesarvspr <vinicius_spr@hotmail.com>
lib/request.js Outdated
@@ -171,6 +172,7 @@ Object.defineProperties(Request.prototype, {
const routeLimit = context._parserOptions.limit
const serverLimit = context.server.initialConfig.bodyLimit
const version = context.server.hasConstraintStrategy('version') ? this.raw.headers['accept-version'] : undefined
const { handler, config } = context
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are taking the reference here and config is an object.
When you deep frozen the object, altering config in else where will be break.

The getter should be immutable, but the hidden value should be allowed to modify by the core.

Copy link
Contributor Author

@cesarvspr cesarvspr Dec 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ptal

Signed-off-by: cesarvspr <vinicius_spr@hotmail.com>
Signed-off-by: cesarvspr <vinicius_spr@hotmail.com>
Signed-off-by: cesarvspr <vinicius_spr@hotmail.com>
Signed-off-by: cesarvspr <vinicius_spr@hotmail.com>
Signed-off-by: cesarvspr <vinicius_spr@hotmail.com>
Signed-off-by: cesarvspr <vinicius_spr@hotmail.com>
@cesarvspr cesarvspr marked this pull request as ready for review December 24, 2022 06:57
@cesarvspr cesarvspr changed the title (#4439) access handler name add properties to req route options (WIP) (#4439) access handler name add properties to req route options Dec 24, 2022
@cesarvspr cesarvspr requested review from Eomm and climba03003 and removed request for Eomm and climba03003 December 24, 2022 07:00
@Eomm
Copy link
Member

Eomm commented Jun 5, 2023

@Fdawgs Fdawgs changed the title (#4439) access handler name add properties to req route options feat: access handler name add properties to req route options Jul 2, 2023
Co-authored-by: Manuel Spigolon <behemoth89@gmail.com>
@Songkeys
Copy link

Songkeys commented Aug 6, 2023

What can we do to move this PR forward?

Currently my logging is full of this:

image

@Uzlopak
Copy link
Contributor

Uzlopak commented Aug 6, 2023

Is this even related to this PR?

Cant you patch your code accordingly?

@SimenB
Copy link
Member

SimenB commented Aug 6, 2023

What can we do to move this PR forward?

From my understanding, only a doc update is missing. So you can probably suggest changes here or PR the fork.

@Songkeys
Copy link

Songkeys commented Aug 6, 2023

Is this even related to this PR?

Cant you patch your code accordingly?

I think this is related to another issue for the opentelemetry which is blocked by this PR? open-telemetry/opentelemetry-js-contrib#1275

@Uzlopak
Copy link
Contributor

Uzlopak commented Aug 6, 2023

I think @SimenB wanted to actually say, that this PR would also add more warnings to the opentelemetry issue.

@Uzlopak
Copy link
Contributor

Uzlopak commented Aug 6, 2023

To fix the issue in opentelemetry, you would need to patch

https://github.com/open-telemetry/opentelemetry-js-contrib/blob/154b30bc98ff0b848348faa18197eb7f11dcbdc4/plugins/node/opentelemetry-instrumentation-fastify/src/instrumentation.ts#L263

There I think you would need to change it to:

      const handlerName = (((request as any).routeConfig || {})?.name || '').substr(6);

@Songkeys
Copy link

Songkeys commented Aug 6, 2023

Just took another look at this PR- yes you're right. Sorry about this. Guess there's some work needed to do on the opentelemetry side then.


Edit: thank you for the patching instruction above! I'll try.

lib/request.js Outdated Show resolved Hide resolved
lib/request.js Outdated Show resolved Hide resolved
@Uzlopak
Copy link
Contributor

Uzlopak commented Aug 21, 2023

I fixed the remaining remarks. It should be ready for merge.

@Eomm PTAL

docs/Reference/Request.md Outdated Show resolved Hide resolved
Co-authored-by: Manuel Spigolon <behemoth89@gmail.com>
Copy link
Member

@Eomm Eomm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need to check these warnings across the repos

Thanks GH code search

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@mcollina mcollina merged commit 59050e5 into fastify:main Sep 4, 2023
28 checks passed
renovate bot added a commit to tomacheese/telcheck that referenced this pull request Sep 11, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [fastify](https://www.fastify.dev/)
([source](https://togithub.com/fastify/fastify)) | [`4.22.2` ->
`4.23.0`](https://renovatebot.com/diffs/npm/fastify/4.22.2/4.23.0) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/fastify/4.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/fastify/4.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/fastify/4.22.2/4.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/fastify/4.22.2/4.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>fastify/fastify (fastify)</summary>

###
[`v4.23.0`](https://togithub.com/fastify/fastify/releases/tag/v4.23.0)

[Compare
Source](https://togithub.com/fastify/fastify/compare/v4.22.2...v4.23.0)

#### What's Changed

- test: reduce output of reqIdGenFactory.test.js by
[@&#8203;Uzlopak](https://togithub.com/Uzlopak) in
[fastify/fastify#5012
- feat: Add onListen Hook by
[@&#8203;BrendenInhelder](https://togithub.com/BrendenInhelder) in
[fastify/fastify#4899
- docs(readme): avoid line breaks in documentation links by
[@&#8203;antoineneff](https://togithub.com/antoineneff) in
[fastify/fastify#5014
- chore(examples): added curly braces to conditions for consistency by
[@&#8203;turnerran](https://togithub.com/turnerran) in
[fastify/fastify#5015
- feat: access handler name add properties to req route options by
[@&#8203;cesarvspr](https://togithub.com/cesarvspr) in
[fastify/fastify#4470
- chore: Bump the dev-dependencies group with 1 update by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[fastify/fastify#5018
- docs: minor improvements by
[@&#8203;Uzlopak](https://togithub.com/Uzlopak) in
[fastify/fastify#5019
- chore(deps): replace tiny-lru with toad-cache by
[@&#8203;kibertoad](https://togithub.com/kibertoad) in
[fastify/fastify#4668
- docs(ecosystem.md): Fix wrong entry for ecosystem.md by
[@&#8203;Uzlopak](https://togithub.com/Uzlopak) in
[fastify/fastify#5021
- perf: use `node:` prefix to bypass require.cache call for builtins by
[@&#8203;Fdawgs](https://togithub.com/Fdawgs) in
[fastify/fastify#5026
- docs(typo): mistype of monkeypatch by
[@&#8203;Menkveld-24](https://togithub.com/Menkveld-24) in
[fastify/fastify#5027
- chore: change website to .dev instead of .io by
[@&#8203;Eomm](https://togithub.com/Eomm) in
[fastify/fastify#5028
- chore: add gurgunday and uzlopak as contributors by
[@&#8203;Uzlopak](https://togithub.com/Uzlopak) in
[fastify/fastify#5029
- chore: add a citgm command to customize what we run in CITGM by
[@&#8203;mcollina](https://togithub.com/mcollina) in
[fastify/fastify#5030

#### New Contributors

- [@&#8203;BrendenInhelder](https://togithub.com/BrendenInhelder) made
their first contribution in
[fastify/fastify#4899
- [@&#8203;antoineneff](https://togithub.com/antoineneff) made their
first contribution in
[fastify/fastify#5014
- [@&#8203;turnerran](https://togithub.com/turnerran) made their first
contribution in
[fastify/fastify#5015
- [@&#8203;Menkveld-24](https://togithub.com/Menkveld-24) made their
first contribution in
[fastify/fastify#5027

**Full Changelog**:
fastify/fastify@v4.22.2...v4.23.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/tomacheese/telcheck).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi44My4wIiwidXBkYXRlZEluVmVyIjoiMzYuODMuMCIsInRhcmdldEJyYW5jaCI6Im1hc3RlciJ9-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
renovate bot added a commit to redwoodjs/redwood that referenced this pull request Sep 12, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [fastify](https://www.fastify.dev/)
([source](https://togithub.com/fastify/fastify)) | [`4.22.2` ->
`4.23.0`](https://renovatebot.com/diffs/npm/fastify/4.22.2/4.23.0) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/fastify/4.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/fastify/4.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/fastify/4.22.2/4.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/fastify/4.22.2/4.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>fastify/fastify (fastify)</summary>

###
[`v4.23.0`](https://togithub.com/fastify/fastify/releases/tag/v4.23.0)

[Compare
Source](https://togithub.com/fastify/fastify/compare/v4.22.2...v4.23.0)

##### What's Changed

- test: reduce output of reqIdGenFactory.test.js by
[@&#8203;Uzlopak](https://togithub.com/Uzlopak) in
[fastify/fastify#5012
- feat: Add onListen Hook by
[@&#8203;BrendenInhelder](https://togithub.com/BrendenInhelder) in
[fastify/fastify#4899
- docs(readme): avoid line breaks in documentation links by
[@&#8203;antoineneff](https://togithub.com/antoineneff) in
[fastify/fastify#5014
- chore(examples): added curly braces to conditions for consistency by
[@&#8203;turnerran](https://togithub.com/turnerran) in
[fastify/fastify#5015
- feat: access handler name add properties to req route options by
[@&#8203;cesarvspr](https://togithub.com/cesarvspr) in
[fastify/fastify#4470
- chore: Bump the dev-dependencies group with 1 update by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[fastify/fastify#5018
- docs: minor improvements by
[@&#8203;Uzlopak](https://togithub.com/Uzlopak) in
[fastify/fastify#5019
- chore(deps): replace tiny-lru with toad-cache by
[@&#8203;kibertoad](https://togithub.com/kibertoad) in
[fastify/fastify#4668
- docs(ecosystem.md): Fix wrong entry for ecosystem.md by
[@&#8203;Uzlopak](https://togithub.com/Uzlopak) in
[fastify/fastify#5021
- perf: use `node:` prefix to bypass require.cache call for builtins by
[@&#8203;Fdawgs](https://togithub.com/Fdawgs) in
[fastify/fastify#5026
- docs(typo): mistype of monkeypatch by
[@&#8203;Menkveld-24](https://togithub.com/Menkveld-24) in
[fastify/fastify#5027
- chore: change website to .dev instead of .io by
[@&#8203;Eomm](https://togithub.com/Eomm) in
[fastify/fastify#5028
- chore: add gurgunday and uzlopak as contributors by
[@&#8203;Uzlopak](https://togithub.com/Uzlopak) in
[fastify/fastify#5029
- chore: add a citgm command to customize what we run in CITGM by
[@&#8203;mcollina](https://togithub.com/mcollina) in
[fastify/fastify#5030

##### New Contributors

- [@&#8203;BrendenInhelder](https://togithub.com/BrendenInhelder) made
their first contribution in
[fastify/fastify#4899
- [@&#8203;antoineneff](https://togithub.com/antoineneff) made their
first contribution in
[fastify/fastify#5014
- [@&#8203;turnerran](https://togithub.com/turnerran) made their first
contribution in
[fastify/fastify#5015
- [@&#8203;Menkveld-24](https://togithub.com/Menkveld-24) made their
first contribution in
[fastify/fastify#5027

**Full Changelog**:
fastify/fastify@v4.22.2...v4.23.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/redwoodjs/redwood).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi44My4wIiwidXBkYXRlZEluVmVyIjoiMzYuODMuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
jtoar pushed a commit to redwoodjs/redwood that referenced this pull request Sep 13, 2023
[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [fastify](https://www.fastify.dev/)
([source](https://togithub.com/fastify/fastify)) | [`4.22.2` ->
`4.23.0`](https://renovatebot.com/diffs/npm/fastify/4.22.2/4.23.0) |
[![age](https://developer.mend.io/api/mc/badges/age/npm/fastify/4.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/fastify/4.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/fastify/4.22.2/4.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/fastify/4.22.2/4.23.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>fastify/fastify (fastify)</summary>

###
[`v4.23.0`](https://togithub.com/fastify/fastify/releases/tag/v4.23.0)

[Compare
Source](https://togithub.com/fastify/fastify/compare/v4.22.2...v4.23.0)

##### What's Changed

- test: reduce output of reqIdGenFactory.test.js by
[@&#8203;Uzlopak](https://togithub.com/Uzlopak) in
[fastify/fastify#5012
- feat: Add onListen Hook by
[@&#8203;BrendenInhelder](https://togithub.com/BrendenInhelder) in
[fastify/fastify#4899
- docs(readme): avoid line breaks in documentation links by
[@&#8203;antoineneff](https://togithub.com/antoineneff) in
[fastify/fastify#5014
- chore(examples): added curly braces to conditions for consistency by
[@&#8203;turnerran](https://togithub.com/turnerran) in
[fastify/fastify#5015
- feat: access handler name add properties to req route options by
[@&#8203;cesarvspr](https://togithub.com/cesarvspr) in
[fastify/fastify#4470
- chore: Bump the dev-dependencies group with 1 update by
[@&#8203;dependabot](https://togithub.com/dependabot) in
[fastify/fastify#5018
- docs: minor improvements by
[@&#8203;Uzlopak](https://togithub.com/Uzlopak) in
[fastify/fastify#5019
- chore(deps): replace tiny-lru with toad-cache by
[@&#8203;kibertoad](https://togithub.com/kibertoad) in
[fastify/fastify#4668
- docs(ecosystem.md): Fix wrong entry for ecosystem.md by
[@&#8203;Uzlopak](https://togithub.com/Uzlopak) in
[fastify/fastify#5021
- perf: use `node:` prefix to bypass require.cache call for builtins by
[@&#8203;Fdawgs](https://togithub.com/Fdawgs) in
[fastify/fastify#5026
- docs(typo): mistype of monkeypatch by
[@&#8203;Menkveld-24](https://togithub.com/Menkveld-24) in
[fastify/fastify#5027
- chore: change website to .dev instead of .io by
[@&#8203;Eomm](https://togithub.com/Eomm) in
[fastify/fastify#5028
- chore: add gurgunday and uzlopak as contributors by
[@&#8203;Uzlopak](https://togithub.com/Uzlopak) in
[fastify/fastify#5029
- chore: add a citgm command to customize what we run in CITGM by
[@&#8203;mcollina](https://togithub.com/mcollina) in
[fastify/fastify#5030

##### New Contributors

- [@&#8203;BrendenInhelder](https://togithub.com/BrendenInhelder) made
their first contribution in
[fastify/fastify#4899
- [@&#8203;antoineneff](https://togithub.com/antoineneff) made their
first contribution in
[fastify/fastify#5014
- [@&#8203;turnerran](https://togithub.com/turnerran) made their first
contribution in
[fastify/fastify#5015
- [@&#8203;Menkveld-24](https://togithub.com/Menkveld-24) made their
first contribution in
[fastify/fastify#5027

**Full Changelog**:
fastify/fastify@v4.22.2...v4.23.0

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined),
Automerge - At any time (no schedule defined).

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/redwoodjs/redwood).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNi44My4wIiwidXBkYXRlZEluVmVyIjoiMzYuODMuMCIsInRhcmdldEJyYW5jaCI6Im1haW4ifQ==-->

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
semver-minor Issue or PR that should land as semver minor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Access handler name