Fork me on GitHub
#re-frame
<
2020-06-03
>
ShaneLester14:06:11

I'm having a fun problem where grabbing a key out of a json response works fine locally but as soon as I push it through my cicd, it no longer does. Essentially, locally I have job-spec-id appropriately being set to a number, but remotely it gets passed along in this request as {job_spec_id: 1795} instead of just 1795. I've done everything locally the same way it seems, compilation config and everything. The only thing that i can think of that is different is that it's using https remotely vs http local. Anyone have any inklings of an idea? Starting to go nuts with this one.

(re-frame/reg-event-fx
 ::save-job
 (fn [{db :db} [_ tms-id comp start-date end-date demos response]]
 (let [job-spec-id (:job_spec_id response)]
    {:http-xhrio {:method          :post
                  :uri             "/api/jobs"
                  :params          {:user_id 2 
                                    :job_spec_id job-spec-id 
                                    :job_name "standard" 
                                    :job_type "standard"}
                  :format          (ajax/json-request-format)
                  :response-format (ajax/json-response-format {:keywords? true})
                  :on-success      [::request-unification tms-id comp start-date end-date demos job-spec-id]
                  :on-failure      [::handle-error :program-metrics]}})))

p-himik14:06:42

Where does the response come from?

ShaneLester14:06:52

Right now this is set up as a chained call from a previous api call. So it's essentially the response from another reg-event-fx that should have decoded it. (Not an ideal setup but it was what was there when i started working on this sadly)

ShaneLester14:06:27

by that i mean, save-job here is called on-success from another one

p-himik14:06:55

Well, it seems that it contains different values depending on where the code is run.

ShaneLester14:06:12

Hmm. Yeah, I'll doublecheck that the response is proper. Visually it looks the same but maybe it is encoded differently

David Pham19:06:09

Are their good reason to not include the track effect from re frame utiles into re frame?

isak20:06:51

@shanelester55 the problem is you cant mix snake and kebab cases like that for the same variable name. Clojurescript just munges the variable names unsafely, so you get issues

isak20:06:28

actually the other one is a keyword, not a variable, so maybe that is not it

ShaneLester20:06:50

That part does seem to work but it's probably not best practice. I'll likely change it. I did end up fixing it for now, but it was something that I still can't quite explain. Our kubernetes deployment was somehow corrupted and this was the only thing that ended up being wrong. We copied our stuff to a new branch and redeployed and now everything works. very strange.

4
4