Skip to content

Uncaught TypeError: Failed to construct 'HTMLElement': Please use the 'new' operator, this DOM object constructor cannot be called as a function. #816

@vnctaing

Description

@vnctaing

Hi,

I'm trying to use the latest @aws-amplify/ui-react instead of the legacy aws-amplify-react

It's somewhat similar to this stackoverflow issue that is using the legacy import { withAuthenticator } from 'aws-amplify-react';. I was able to make things work with the legacy aws-amplify-react library.

(ns myapp.core (:require ["@aws-amplify/ui-react" :refer (AmplifyAuthenticator, AmplifySignUp, AmplifySignOut)] ["aws-amplify" :default Amplify :as amp] ["/aws-exports.js" :default aws-exports] (:import goog.History)) (def authenticator (r/adapt-react-class AmplifyAuthenticator )) (def signup (r/adapt-react-class AmplifySignUp )) (def amplify-signout (r/adapt-react-class AmplifySignOut )) (defn home [] ...... [authenticator [:div [amplify-signout]] ] ) 

But this outputs

Uncaught TypeError: Failed to construct 'HTMLElement': Please use the 'new' operator, this DOM object constructor cannot be called as a function.

I'm expecting it to render the signout component I tried to change the output build to es6 or es8 but no dice

 :builds {:app {:target :browser :compiler-options {:output-feature-set :es8} :output-dir "target/cljsbuild/public/js" :asset-path "/js" :modules {:app {:entries [tartataing.app]}} :devtools {:watch-dir "resources/public"}} 

Here's the reproducible repo : https://github.com/vnctaing/tartataing/blob/main/src/cljs/tartataing/core.cljs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions