Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught DOMException #140

Closed
pandelig opened this issue Jul 19, 2021 · 2 comments
Closed

Uncaught DOMException #140

pandelig opened this issue Jul 19, 2021 · 2 comments

Comments

@pandelig
Copy link

Hello, trying to set up Schnack on heroku and even though it works when it runs locally (heroku local web):
image

after the push on heroku it shows Uncaught DOMException error when trying to load this script (asdasdasd is not the actual name):
image

the exact error messages are:

  • Firefox
    image
  • Chrome
    image

since using a config.json didn't seem to work, i edited the src/config.js file directly as such:
image

Procfile:
image

heroku environmental variables:
image

same as the local environmental variables defined in a .env file, this filed is used when the command "heroku local web" is run which as i mentioned earlier loads the Schnack script fine:
image

let me know if there is any other information i can provide, my goal here is to use Schnack as a basis and expand on it by eg adding anonymous comments, so suggestions to deploy it somewhere else other than heroku are also welcome, thanks

@pandelig
Copy link
Author

pandelig commented Jul 21, 2021

Update: deployed the app on Digital Ocean and the same exact message appears on the dev console on Firefox, so the error turns out is not Heroku specific
Interestingly, the dev console error on Chrome is different this time:
image

@pandelig
Copy link
Author

pandelig commented Jul 22, 2021

The script ended up loading successfully after commenting out this part of the code from src/embed/client.js:
image

and then running "npm run build" so that the embeds will be recompiled.
The DOMException seems to happen when we try to set the document.domain to something unacceptable (1 2).

I will mention though that the 2 authentication methods i've tried (github and mastodon) aren't working, maybe it is related to commenting out that piece of code.

EDIT: Solution: got a domain name "www.blabla.com" and therefore could uncomment the piece of code mentioned above

  1. if your domain is called just "blabla.com" the above code will trim it down to just "com" causing the DOMException
  2. just commenting out the code in the picture is not a good solution because in the src/server.js file, the respond to "/success" is also a script that gives a value to document.domain, if you comment that out too, authentication will not work
  3. if you only have an IP address (eg DigitalOcean website) you will probably have various issues with document.domain and also with the authentication methods
  4. got the github authentication working thanks to the registered domain, it wasn't working with just the IP address of DigitalOcean

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant