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

embed.min.js - loading failed #656

Closed
curiousdungbeetle opened this issue Jun 24, 2020 · 8 comments
Closed

embed.min.js - loading failed #656

curiousdungbeetle opened this issue Jun 24, 2020 · 8 comments

Comments

@curiousdungbeetle
Copy link

curiousdungbeetle commented Jun 24, 2020

Hello,

I'm trying to set up isso for a Ghost blog on a Ubuntu 18.04 server on DigitalOcean, with nginx and isso installed with pip. My blog is on https://mydomain.tld and isso on https://isso.mydomain.tld. My issue is that I get Loading failed for the <script> with source “https://isso.mydomain.tld/js/embed.min.js” in the console. However I can access the admin page OK!

Running isso -c /config/isso.conf run seems all good.

Here is my isso.conf:

[general]
dbpath = /var/lib/isso/mydomain.comments.db
host = https://mydomain.tld/
max-age = 15m
notify = stdout
log-file = /var/log/isso.log

[moderation]
enabled = false

[admin]
enabled = true
password = <my password>

[server]
listen = http://localhost:8080
reload = off
profile = off

Here is the nginx conf file for isso.mydomain.tld.conf:

server {
    listen 80;
    listen [::]:80;

    server_name isso.mydomain.tld

    if ($host = isso.mydomain.tld) {
        return 301 https://$host$request_uri;
    }

    return 404;
}

and the nginx conf file for isso.mydomain.tld-ssl.conf:

server {
    listen 443 ssl http2;
    listen [::]:443 ssl http2;

    server_name isso.mydomain.tld;
    root /var/www/ghost/system/nginx-root; # Used for acme.sh SSL verification (https://acme.sh)

    ssl_certificate /etc/letsencrypt/isso.mydomain.tld/fullchain.cer;
    ssl_certificate_key /etc/letsencrypt/isso.mydomain.tld/isso.mydomain.tld.key;
    include /etc/nginx/snippets/ssl-params.conf;

    access_log /var/log/nginx/isso-access.log;
    error_log  /var/log/nginx/isso-error.log;

    location / {
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header Host $http_host;
        proxy_pass http://localhost:8080;

    }

    location ~ /.well-known {
        allow all;
    }

    client_max_body_size 50m;
}

}

And here is the client JS, for a Ghost blog:

<section class="post-full-comments">
	<script
		data-isso="//isso.mydomain.tld/"
		data-isso-lang="en"
		data-isso-vote="false"
	src="//isso.mydomain.tld/js/embed.min.js"></script>
	<section id="isso-thread"></section>
</section>

Thanks for any support!
CDB

@curiousdungbeetle curiousdungbeetle changed the title Not working with https embed.min.js - loading failed Jun 24, 2020
@curiousdungbeetle
Copy link
Author

I think I have fixed it, by upgrading isso to the master branch directly from github. So probably something broken when installing from latest release...
(I ran pip3 install git+git://github.com/posativ/isso@master --no-binary :all: - it would segfault without the --no-binary :all: flag)

jefft added a commit to redradishtech/isso that referenced this issue Jul 10, 2020
@jefft
Copy link
Contributor

jefft commented Jul 10, 2020

I get this too if I install directly from git (e.g. pip3 install git+https://github.com/posativ/isso.git). I don't have this problem if I install 0.12.2 normally (pip3 install isso), but that version is broken in other ways (#617).

I'm guessing that when the maintainer built the official 0.12.2 distro in pypy, they did it with:

make init js             # Fetch js deps and minify js files. This leaves embed.min.js in build/
python3 setup.py sdist bdist_wheel     # Build source and binary distros, reusing what's in build/
twine upload dist/*              # Upload to pypy

When pip3 install git+... is run, something like the following happens:

git clone https://github.com/posativ/isso.git x
cd x
python3 setup.py bdist_wheel

The result is unusable, because the critical make init js build step is missed. The generated dist/isso-*.whl file is missing embed.min.js and friends.

I think a first step towards fixing this would be to automatically invoke make init js as part of the python setup.py bdist_wheel build step. I have done so at redradishtech@e347a68 in my fork.

The problem then is that make init js requires npm and bower installed. That is unlikely to be the case for random users running pip3 install git+....

In my fork (https://github.com/redradishtech/isso) I've just committed the files fetched and generated by make init js. I can't think of a nicer solution, aside from just releasing 0.12.3 :)

@jefft
Copy link
Contributor

jefft commented Aug 6, 2020

I thought of isso's build problem when reading https://snarky.ca/what-the-heck-is-pyproject-toml/

"the purpose of PEP 518 was to come up with a way for projects to specify what build tools they required" <-- Yep, isso needs npm and bower.

@madranet
Copy link

madranet commented Oct 27, 2020

Thanks @jefft for providing the embed.min.js file. My comments are now back in action.

But I've just spent about an hour trying to work out why Isso, which had been running smoothly for a couple of years on my server, was suddenly dead and resisting all efforts to coax it back to life again --even after uninstalling and re-installing pipenv and isso.

How the heck has this issue been allowed to persist since June without any fix or even a mention of it at all in the official documentation? Are users really supposed to dig through multiple arcane Github issues to try and find why Isso suddenly doesn't work any more?

@jelmer
Copy link
Member

jelmer commented Oct 27, 2020

@madranet How are you installing isso? Installing from git using pip has never worked AFAIK.

@madranet
Copy link

Installing from pip always worked for me before. In fact I wrote a learned treatise on it [ahem!], a while back:

This time, I've had to resort to installing with pip install git+https://github.com/posativ/isso.git which worked to get Isso running again, where previously it wouldn't even launch. But the .venv/lib/python3.8/site-packages/isso/js/embed.min.js file wasn't created. So I had to nab that from @jefft's fork repo.

@jelmer
Copy link
Member

jelmer commented Feb 5, 2021

@madranet Yes, from pip directly would have worked - from git using pip has never worked - as you point out, due to the fact that the javascript doesn't get built in that case.

@ix5
Copy link
Member

ix5 commented Dec 21, 2021

To summarize, @curiousdungbeetle tried installing the isso package directly from a git clone (i.e. pip3 install git+https://github.com/posativ/isso.git) without building the required javascript files using make init js.

This type of installation is not supported or officially documented anywhere and was a workaround to a broken isso package in pypi recommended by well-meaning individuals in the comments of this bug tracker who were ultimately causing more harm than good.

@curiousdungbeetle would you mind closing this then?

@ix5 ix5 closed this as completed Dec 26, 2021
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

5 participants