JustinBack
(Justin René Back)
December 10, 2022, 8:49am
1
After doing an update today and enabling the S3_CDN_URL Option in the envs, everything but markdown-it-bundle loads.
https://tosdr.community/https://tosdr-community.s3.jrbit.de/assets/markdown-it-bundle-5a633717415fd164893a925e4cac1406ecab8179d15637506b08a147ab543433.br.js
While the assets on the server exist and have been uploaded, discourse still prefixes with the base url.
All other assets work just fine.
I have checked the uploads table, and all urls have the proper format.
Is there any other table I can look into or just a plain fix for this issue?
Is there any DbHelper like remap
but for searching a string in the whole database?
1 Like
Did you follow a guide for setting up Discourse with S3? It seems like there is a lot of sophisticated straps you have to follow in order to set it up, according to this topic:
This topic covers how to configure some common S3 compatible Object Storage providers (S3 clones). See Set up file and image uploads to S3 for more details about Amazon AWS S3 configuration, which is officially supported and used internally by Discourse for our hosting services.
Provider
Service Name
Works with Discourse?
Amazon AWS
S3
Yes
Digital Ocean
Spaces
Yes
Linode
Object Storage
Yes
Google Cloud
Storage
Yes
Scaleway
Object Storage
Yes
Vultr
Obj…
1 Like
I’m afraid this isn’t my forte, but I found this topic with a similar issue, if that might be of some help?
When configuring Object Store, preview for topics/posts are not working.
Discourse is configured with an Object Store
Install is on docker, following the doc.
Discourse version: 2.8.0.beta11
Here are my env variables for S3 configs:
DISCOURSE_CDN_URL: https://discourse.liiib.re
DISCOURSE_USE_S3: true
DISCOURSE_S3_REGION: default
DISCOURSE_S3_ENDPOINT: https://hot-objects.liiib.re
DISCOURSE_S3_ACCESS_KEY_ID: ACCESS_KEY_ID
DISCOURSE_S3_SECRET_ACCESS_KEY: SUPER_SECRET_KEY
DISCOU…
2 Likes
JustinBack
(Justin René Back)
December 12, 2022, 11:02pm
8
@crcoli7307 Yes that was exactly the topic I followed through
@JammyDodger
Thank you for the topic!
So I changed the S3_CDN_URL to:
DISCOURSE_S3_CDN_URL: https://s3.jrbit.de/tosdr-community
But sadly this broke everything, in terms of where the stylesheet loads from.
Could this be the bucket name as its almost equal to the domain?
Bucket name: tosdr-community
Domain: tosdr.community
See how the stylesheets are constructed.
JustinBack
(Justin René Back)
December 13, 2022, 12:39am
9
Just migrated to a new bucket: Its not the name of the bucket, same issue happening
JustinBack
(Justin René Back)
December 13, 2022, 8:34pm
10
UPDATE: I just checked the way markdown-it-bundle is embedded and executed the script_asset_path through the rail console (with slight modifications due to the missing request.env variable!)
According to the script_asset_path, the asset url is correctly generated. Still not sure why this is happening.
EDIT:
It seems to be a known bug
I’m also in this situation with an object store configured (minio) but no CDN. Is it a use case that could be supported ?
From what I’m seeing so far in my tests there is only the markdown-it-bundle js file that is having issues as its pointing to the wrong URL - DISCOURSE_HOSTNAME/DISCOURSE_S3_CDN_URL/assets/markdown-it-bundle-HASH.br.js
It actually looks lit a bug for this one, if I set DISCOURSE_CDN_URL variable, it still points to the wrong URL in this form DISCOURSE_HOSTNAME/DISCOURSE_CD…
EDIT 2:
I “fixed” it by using the most dirtiest workaround available. Hardcoding the Asset in the nginx config and redirecting it
location ~ markdown-it-bundle-dcd9743077867b3a68d7b723130cb2711dc4c843b018d7bc609f868289402fef.(.*).js {
return 302 https://tosdr-forum.s3.jrbit.de/assets/markdown-it-bundle-dcd9743077867b3a68d7b723130cb2711dc4c843b018d7bc609f868289402fef.$1.js;
}
Did the trick, unless the asset is updated
1 Like