-
Notifications
You must be signed in to change notification settings - Fork 37
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
oEmebed resources not loaded in Craft Cloud environment #158
Comments
@svale Hmm sorry to hear that you're having issues, I personally haven't used Craft Cloud before and will have to spin up a trial account. I'm booked time wise for Friday (Leaving work early for a festival) and Saturday (My birthday). I might be able to slot some time in on Sunday. Now I know what a pain this is to deal with personally when you have to wait, so I'd suggest asking Craft Cloud if they have any additional information about ways it could be having issues. It could be a configuration issue rather than an actual problem with the plugin itself. That being said, if it's not, I'll differently be happy to help out when I'm available again I just don't want to slow you guys down too much. FYI I'm based in Melbourne AEST to help out with timeframes |
No worries, enjoy the festival and your birthday 🎉 ! |
@reganlawton Please reach out if you need any help. Here or @timkelty on Discord. |
Hi @timkelty Seems that the Craft Cloud has assets’ upgrades. Can you confirm this: https://craftcms.com/knowledge-base/cloud-plugin-development I was playing around yesterday and found that URL I'm just trying to get as much done before trying out on the trial version on Craft Cloud. Being open-source, I don't really want to risk having the cost hit my personal card 😅 want to help the community seeing as this plugin is used so much I want to have Craft Cloud support. |
@svale Ok with the help of the CraftCMS team and a little bit of troubleshooting I have a sandbox account and working site and can see the issue. I'll work on the fixes for you you, and others, tonight. Hoping it shouldn't be a hard fix though. |
That is super - thanks, @reganlawton! |
It's a new service so always bugs. Overall good system I'll just to find the cause and will be reviewing tonight |
@svale This will be the issue right here I've made it some the system only gets the LINK and SCRIPT on the CP dynamically cos of an old issue. I'll have to reengineer the asset handling and then it should be simple as that. Might be abit of trial and error so Craft Cloud is new but shouldn't be a crazy issue. |
OK! It seems the issue is with the handling of the registration of the build process of the CDN, as expected. Current code: Event::on(
View::class,
View::EVENT_END_PAGE,
function(Event $event) {
if (Craft::$app->getRequest()->getIsCpRequest() && preg_match('/^\/.+\/entries\//', Craft::$app->getRequest()->getUrl())) {
$url = Craft::$app->assetManager->getPublishedUrl('@wrav/oembed/assetbundles/oembed/dist/js/oembed.js', true);
echo "<script src='$url'></script>";
$url = Craft::$app->assetManager->getPublishedUrl('@wrav/oembed/assetbundles/oembed/dist/css/oembed.css', true);
echo "<link rel='stylesheet' href='$url'>";
}
}
); Test code: Craft::$app->getView()->registerAssetBundle(OembedAsset::class);
Event::on(
View::class,
View::EVENT_END_PAGE,
function(Event $event) {
if (Craft::$app->getRequest()->getIsCpRequest() && preg_match('/^\/.+\/entries\//', Craft::$app->getRequest()->getUrl())) {
$url = Craft::$app->assetManager->getPublishedUrl('@wrav/oembed/assetbundles/oembed/dist/js/oembed.js', true);
echo "<script src='$url'></script>";
$url = Craft::$app->assetManager->getPublishedUrl('@wrav/oembed/assetbundles/oembed/dist/css/oembed.css', true);
echo "<link rel='stylesheet' href='$url'>";
}
}
); So basically I just added the extra code to check if it was just not being published cos the code we only want to show in the CP pages. This was done due to someone reporting YEARS AGO the assets were showing on the site and conflicting with admin panels. I think the best way of dealing with this now that CraftCMS is much more advanced is just: if (!Craft::$app->getRequest()->getIsSiteRequest()) {
Craft::$app->getView()->registerAssetBundle(OembedAsset::class);
} This will have the CP working as expected, the CLI level with pick up the asset bundle. @svale Can you try using my feature branch I'm messing around with to see if it works for your side aswell? compose.json: "wrav/oembed": "dev-feature/craft-cloud-support", |
this looks great! I've tested the feature branch locally (DDEV) and on Craft Cloud and it seems to work perfectly, both the backend and the field data in the twig frontend 🙌 |
I'll work to update a release version today and will check my other plugins 🙌 |
@reganlawton glad you got it working! Couple notes:
|
@timkelty Oh I was understanding that it was the console requests that we're generating the CDN assets. This is great to know! Thank you, new system to understand 😅 |
@reganlawton, a console request does generate the assets ( So, your assets were actually getting generated all along, but just weren't being linked to properly. Using |
Thank you for the clarity much appreciated 🙏 @timkelty |
FWIW, |
Is there a reason why the console request logic isn't implemented yet? I see a new release is created about half an hour ago, but that version (3.1.0) still breaks all |
This has been updated and a new release created. |
Hi,
I'm not sure if this is an issue that should be logged here or with Craft Cloud.
It seems the plugin asset resources (CSS and JS) are not loaded when our CP is deployed to Craft Cloud environments
The plugin works as expected in the local DDEV env.
Craft Pro 5.3.0.3
Plugins
Amazon S3 2.2.1
Asset Usage 4.0.0
CKEditor 4.1.0
Embedded Assets 5.1.1
Expanded Singles 3.0.0
Feed Me 6.2.1
Field Manager 4.0.2
Formie 3.0.0
Hyper 2.0.3
Imager X 5.0.1
Imager X Craft Cloud Transformer 1.0.0-beta.1
Many to Many 4.0.0
oEmbed 3.0.9
Retcon 3.2.0
SEO 5.1.1
Sprig 3.2.1
Vite 5.0.0
The text was updated successfully, but these errors were encountered: