title: Redux-observable POST ajax request never sends the network request
body: <p>I have this <a href="https://redux-observable.js.org/" rel="nofollow noreferrer">redux-observable</a> epic that <code>POST</code>s a json body to my backend, but it never actually gets so far as to send the actual network request. It uses <a href="https://xgrommx.github.io/rx-book/content/rxjs_bindings/dom/ajax/post.html" rel="nofollow noreferrer">Rx.DOM.Request.post(url, [body])</a> (I think? please view my imports to confirm). I can verify that the network request never makes it out of my app, let alone hits my backend:</p>
  
  <pre><code>import { Observable } from 'rxjs'
  import 'redux-observable'
  import {
    UPLOAD_IMAGE,
    UPLOAD_IMAGE_FULFILLED,
    UPLOAD_IMAGE_REJECTED,
    UPLOAD_PRODUCT,
    uploadImageFulfilled,
    uploadImageRejected,
    uploadProductFulfilled,
    uploadProductRejected
  } from './addForm.action'
  import {
    updateAlertModalIsOpen,
    updateAlertModalMessage,
    updateAlertModalTitle
  } from '../alert-modal/alertModal.action'
  import 'rxjs/add/operator/catch'
  import { RNS3 } from 'react-native-aws3'
  import { ajax } from 'rxjs/observable/dom/ajax'
  
  export const uploadProductEpic = action$ =&gt;
    action$.ofType(UPLOAD_PRODUCT)
      .mergeMap(action =&gt; {
        ajax.post(
          'http://192.168.20.3:4000/products', 
          action.payload,
          { 'Content-Type': 'application/json' })
      })
      .map(response =&gt; uploadProductFulfilled(response))
      .catch(error =&gt; Observable.of(uploadProductRejected(error)))
  </code></pre>
  
  <p>It gets invoked by a button press:</p>
  
  <pre><code>      onPress={() =&gt; {
         let product = {
                "name": props.name,
                "brand": props.brand,
                "description": props.description,
                "image": "fakeUrl"
            }
  
          props.uploadProduct(JSON.stringify(product))
  </code></pre>
  
  <p>this is the contents of <code>action</code> object in the above epic:</p>
  
  <pre><code>payload: "{"name":"v","brand":"v","description":"v","image":"fakeUrl"}"
  type: "UPLOAD_PRODUCT"
  </code></pre>
  
  <p>Is it because my json is using all double quotes with no escapes?</p>
  
  <p>I can verify the line of code in the epic that performs the ajax post does run when pressing the button, and the on the first button press it ends up dispatching the <code>uploadProductRejected(error)</code>, without even making the network request, and where error that gets dispatched in the <code>uploadProductRejected</code> action is just <code>{ }</code> and on subsequent button presses it never even dispatches a rejected or fulfilled action. </p>
  
  <p>Any idea why it is rejected, and why it never even attempts to make the network request?</p>