title: Sentry.io Managing error scopes/contexts on asynchronous Node.js Server
body: <p>Basically you have concurrent requests in Node.js.
  And you probably want to enrich possible errors with data specific to each request.
  This request-specific data can be gathered in different parts of the app via</p>
  
  <ul>
  <li><code>Sentry.configureScope(scope =&gt; scope.setSomeUsefulData(...))</code></li>
  <li><code>Sentry.addBreadcrumb({ ... })</code></li>
  </ul>
  
  <p>Later on somewhere in a deep nested asynchronous function call The Error gets thrown.
  How does Sentry know which of the data previously gathered is actually relevant to this particular error, considering requests are handled simultaneously and at the point where an error happens there's no access to some sentry "scope" to get data relevant to this particular request which resulted in the error.</p>
  
  <p>Or do I have to pass sentry scope through all my function calls? Like</p>
  
  <pre class="lang-js prettyprint-override"><code>server.on('request', (requestContext) =&gt; {
    // Create new Sentry scope
    Sentry.configureScope(sentryScope =&gt; {
      Products.getProductById(id, sentryScope); // And pass it on
    });
  });
  
  // all the way down until...
  
  function parseNumber(input, sentryScope) {
    // ...
  }
  </code></pre>
  
  <p>Or does sentry use some sort of magic to map specific data to relevant events? Or am I missing something?</p>