title: Error using redux saga, take(patternOrChannel): argument 8 is not valid channel or a valid pattern
body: <p>I'm trying to use redux saga library to capture some actions but I'm having this error when I run the app:</p>
  
  <blockquote>
    <p>index.js:2178 uncaught at rootSaga at rootSaga   at projectSaga   at
    watchFetchRequest   at takeEvery   Error: take(patternOrChannel):
    argument 8 is not valid channel or a valid pattern
     at take (<a href="http://localhost:3000/static/js/bundle.js:84689:9" rel="noreferrer">http://localhost:3000/static/js/bundle.js:84689:9</a>)
        at takeEvery (<a href="http://localhost:3000/static/js/bundle.js:85993:94" rel="noreferrer">http://localhost:3000/static/js/bundle.js:85993:94</a>)
        at createTaskIterator (<a href="http://localhost:3000/static/js/bundle.js:85179:17" rel="noreferrer">http://localhost:3000/static/js/bundle.js:85179:17</a>)
        at runForkEffect (<a href="http://localhost:3000/static/js/bundle.js:85583:24" rel="noreferrer">http://localhost:3000/static/js/bundle.js:85583:24</a>)
        at runEffect (<a href="http://localhost:3000/static/js/bundle.js:85468:872" rel="noreferrer">http://localhost:3000/static/js/bundle.js:85468:872</a>)
        at next (<a href="http://localhost:3000/static/js/bundle.js:85348:9" rel="noreferrer">http://localhost:3000/static/js/bundle.js:85348:9</a>)
        at proc (<a href="http://localhost:3000/static/js/bundle.js:85303:3" rel="noreferrer">http://localhost:3000/static/js/bundle.js:85303:3</a>)
        at runForkEffect (<a href="http://localhost:3000/static/js/bundle.js:85587:19" rel="noreferrer">http://localhost:3000/static/js/bundle.js:85587:19</a>)
        at runEffect (<a href="http://localhost:3000/static/js/bundle.js:85468:872" rel="noreferrer">http://localhost:3000/static/js/bundle.js:85468:872</a>)
        at <a href="http://localhost:3000/static/js/bundle.js:85677:14" rel="noreferrer">http://localhost:3000/static/js/bundle.js:85677:14</a>
        at Array.forEach ()
        at runAllEffect (<a href="http://localhost:3000/static/js/bundle.js:85676:10" rel="noreferrer">http://localhost:3000/static/js/bundle.js:85676:10</a>)
        at runEffect (<a href="http://localhost:3000/static/js/bundle.js:85468:413" rel="noreferrer">http://localhost:3000/static/js/bundle.js:85468:413</a>)
        at next (<a href="http://localhost:3000/static/js/bundle.js:85348:9" rel="noreferrer">http://localhost:3000/static/js/bundle.js:85348:9</a>)
        at proc (<a href="http://localhost:3000/static/js/bundle.js:85303:3" rel="noreferrer">http://localhost:3000/static/js/bundle.js:85303:3</a>)
        at runForkEffect (<a href="http://localhost:3000/static/js/bundle.js:85587:19" rel="noreferrer">http://localhost:3000/static/js/bundle.js:85587:19</a>)
        at runEffect (<a href="http://localhost:3000/static/js/bundle.js:85468:872" rel="noreferrer">http://localhost:3000/static/js/bundle.js:85468:872</a>)
        at <a href="http://localhost:3000/static/js/bundle.js:85677:14" rel="noreferrer">http://localhost:3000/static/js/bundle.js:85677:14</a>
        at Array.forEach ()
        at runAllEffect (<a href="http://localhost:3000/static/js/bundle.js:85676:10" rel="noreferrer">http://localhost:3000/static/js/bundle.js:85676:10</a>)
        at runEffect (<a href="http://localhost:3000/static/js/bundle.js:85468:413" rel="noreferrer">http://localhost:3000/static/js/bundle.js:85468:413</a>)
        at next (<a href="http://localhost:3000/static/js/bundle.js:85348:9" rel="noreferrer">http://localhost:3000/static/js/bundle.js:85348:9</a>)
        at proc (<a href="http://localhost:3000/static/js/bundle.js:85303:3" rel="noreferrer">http://localhost:3000/static/js/bundle.js:85303:3</a>)
        at runSaga (<a href="http://localhost:3000/static/js/bundle.js:85858:76" rel="noreferrer">http://localhost:3000/static/js/bundle.js:85858:76</a>)
        at Object../src/store/ReduxRoot.tsx (<a href="http://localhost:3000/static/js/bundle.js:95823:16" rel="noreferrer">http://localhost:3000/static/js/bundle.js:95823:16</a>)
        at <strong>webpack_require</strong> (<a href="http://localhost:3000/static/js/bundle.js:679:30" rel="noreferrer">http://localhost:3000/static/js/bundle.js:679:30</a>)
        at fn (<a href="http://localhost:3000/static/js/bundle.js:89:20" rel="noreferrer">http://localhost:3000/static/js/bundle.js:89:20</a>)
        at Object../src/index.tsx (<a href="http://localhost:3000/static/js/bundle.js:95325:75" rel="noreferrer">http://localhost:3000/static/js/bundle.js:95325:75</a>)
        at <strong>webpack_require</strong> (<a href="http://localhost:3000/static/js/bundle.js:679:30" rel="noreferrer">http://localhost:3000/static/js/bundle.js:679:30</a>)
        at fn (<a href="http://localhost:3000/static/js/bundle.js:89:20" rel="noreferrer">http://localhost:3000/static/js/bundle.js:89:20</a>)
        at Object.0 (<a href="http://localhost:3000/static/js/bundle.js:96424:18" rel="noreferrer">http://localhost:3000/static/js/bundle.js:96424:18</a>)
        at <strong>webpack_require</strong> (<a href="http://localhost:3000/static/js/bundle.js:679:30" rel="noreferrer">http://localhost:3000/static/js/bundle.js:679:30</a>)
        at ./node_modules/@babel/runtime/helpers/arrayWithoutHoles.js.module.exports
    (<a href="http://localhost:3000/static/js/bundle.js:725:37" rel="noreferrer">http://localhost:3000/static/js/bundle.js:725:37</a>)
        at <a href="http://localhost:3000/static/js/bundle.js:728:10" rel="noreferrer">http://localhost:3000/static/js/bundle.js:728:10</a></p>
  </blockquote>
  
  <p>This is the saga code:</p>
  
  <pre><code>import { all, call, fork, put, takeEvery } from 'redux-saga/effects';
  import {  ActionType, Action, SearchCriteria } from '../model/types';
  import { searchProjectsError, searchProjectsCompleted } from '../actions/projects';
  import { API_URL } from '../../config';
  // import axios from 'axios';
  
  function callApi(method: string, url: string, path: string, data?: any) {
      return fetch(url  + path, {
        method,
        headers: {'Content-Type': 'application/json; charset=utf-8', 'Access-Control-Allow-Origin': '*'},
        body: JSON.stringify(data)
      }).then(res =&gt; res.json());
    }
  
  // Here we use `redux-saga` to trigger actions asynchronously. `redux-saga` uses something called a
  // "generator function", which you can read about here:
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*
  
  function* handleFetch(action: Action&lt;SearchCriteria&gt;) {
    try {
      // To call async functions, use redux-saga's `call()`.
      const res = yield call(callApi, 'get', API_URL , '/api/DocumentLoader/GetProjects/', action.payload);
  
      if (res.error) {
        yield put(searchProjectsError(res.error));
      } else {
        yield put(searchProjectsCompleted(res));
      }
    } catch (err) {
      if (err instanceof Error) {
        yield put(searchProjectsError(err.stack!));
      } else {
        yield put(searchProjectsError('An unknown error occured.'));
      }
    }
  }
  
  // This is our watcher function. We use `take*()` functions to watch Redux for a specific action
  // type, and run our saga, for example the `handleFetch()` saga above.
  function* watchFetchRequest() {
    yield takeEvery(ActionType.SEARCH_PROJECTS, handleFetch); // I think the error is here
  }
  
  // We can also use `fork()` here to split our saga into multiple watchers.
  function* projectSaga() {
    yield all([fork(watchFetchRequest)]);
  }
  
  export default projectSaga;
  </code></pre>
  
  <p>I already tried to find an answer here in SO, but the only I could find was <a href="https://stackoverflow.com/questions/48378562/redux-saga-get-data-from-action-returns-patternorchannel-is-undefined">this post</a>, but <code>ActionType</code> is been exported. I think the problem is with the parameter of <code>handleFetch</code> function</p>
  
  <p>This is the action:</p>
  
  <pre><code>export function searchProjects(criterias: SearchCriteria): Action&lt;SearchCriteria&gt; {
      return {
          type: ActionType.SEARCH_PROJECTS,
          payload: criterias
      };
  }
  </code></pre>
  
  <p>Another thing it could be is maybe I did something wrong at the time to compose the saga middleware:</p>
  
  <pre><code>const sagaMiddleware = createSagaMiddleware();
  
  var middleware = applyMiddleware(logger, thunk, sagaMiddleware);
  
  if (process.env.NODE_ENV === 'development') {
      middleware = composeWithDevTools(middleware);
  }
  
  // Here we use `redux-saga` to trigger actions asynchronously. `redux-saga` uses something called a
  // "generator function", which you can read about here:
  // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/function*
  export function* rootSaga() {
      yield all([fork(projectSaga)]);
    }
  // running the root saga, and return the store object.
   sagaMiddleware.run(rootSaga);
  </code></pre>
  
  <p>I also tried removing the action parameter from <code>handleFetch</code> and the error is still happening</p>