This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-11-12
Channels
- # announcements (15)
- # babashka (8)
- # babashka-sci-dev (8)
- # beginners (19)
- # biff (18)
- # cider (7)
- # clj-kondo (1)
- # clojure (6)
- # clojure-europe (24)
- # clojure-norway (10)
- # clojure-spec (1)
- # clojurescript (11)
- # conjure (1)
- # core-async (1)
- # cursive (3)
- # devops (1)
- # emacs (1)
- # fulcro (1)
- # helix (4)
- # keechma (1)
- # off-topic (19)
- # pathom (4)
- # reagent (2)
- # reitit (1)
- # shadow-cljs (8)
- # spacemacs (1)
- # vim (7)
Hi all! Anyone have any experience working with the aws-cognito and using amazon-cognito-identity-js
in reagent+re-frame application. I am trying to write signup handler in cljs but I am getting the Serialization error i.e. Start of structure or map found where not expected
. Can any one help me in what I am doing wrong?
(def coginto-user-pool (new CognitoUserPool (clj->js {:region "xxxx"
:UserPoolId "xxx"
:ClientId "xxxx"})))
(defn sign-up-handler
[email password]
(. coginto-user-pool signUp
email
password
[(new CognitoUserAttribute {:Name "email" :Value email})]
nil
(fn [error data]
(if error
(do (js/console.log error)
(error-notifier "Sign Up Failed"))
(do
(success-notifier "Verification email has been sent to your email address")
(js/console.log "Sign Up Success" data))))))
(new CognitoUserAttribute ...)
- are you use there isn't supposed to be a #js
literal there, in front of the argument map? (a compile-time alternative for clj->js
).
I have tried to do it but still the same serialization error
The error surely has a stack trace. Have you tried following it in run time, seeing what data is in there?
I am assuming I am sending the wrong arguments (but I have followed the documentation). Only error I am getting on submitting the form is the Serialization one
You can break on requests to specific URLs, on exceptions, at specific places - all that is usually more than enough to debug such errors.
Sure, let me try but I am assuming there is something with the arguments.
It very well might be. But more often than not it's much faster and much easier to debug it yourself rather than wait that someone with just the right knowledge comes by your question, has some back-and-forth with you, and figures out what's wrong. ;)
(defn sign-up [email password]
(let [user-pool (AmazonCognitoIdentity/CognitoUserPool.
#js {:UserPoolId ""
:ClientId ""})
attributes #js [(AmazonCognitoIdentity/CognitoUserAttribute.
#js {:Name "email" :Value email})]]
(.signUp user-pool email password attributes nil
(fn [err result]
(js/console.log err)
(js/console.log result)))))