meteor / meteor/validated-method
_execute not passing down context to nested ValidatedMethods
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 193
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Description
First, thank you for this highly useful package! :tada:
I have the following situation:
One `ValidatedMethod` (on the server) A is calling another `ValidatedMethod` B (again on the server only).
Now if I `_execute()` the outer method A and pass it a `userId` context, that `userId` gets lost in the inner method B, and `userId` is again `undefined`.
# Reproduction
https://github.com/workflow/validated-method-repro
# Outcome
```
I20170425-21:29:03.151(2)? Outer method userId: fXHHHMYTzzk3i4eKf
I20170425-21:29:03.152(2)? Inner method userId: null
```
# Desired
```
I20170425-21:29:03.151(2)? Outer method userId: fXHHHMYTzzk3i4eKf
I20170425-21:29:03.152(2)? Inner method userId: fXHHHMYTzzk3i4eKf
```
The only workaround I've found so far is to `_execute` B instead of `call`ing it, explicitly passing down the `userId`. Not very pretty, since this affects production code to make the tests work.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the _execute and call paths in validated-method, using the linked reproduction to observe how context changes between nested ValidatedMethods. Trace the server-side context passed from outer method A to inner method B; done means the inner method receives the same userId without callers explicitly passing it.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100