meteor / meteor/validated-method

_execute not passing down context to nested ValidatedMethods

Open
#72 4 comments 3 reactions 0 assignees View on GitHub

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

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.