Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello,
When using bootstrap on a Drupal 8 website without Internet access, an exception is raised during discovery of Bootstrap CDN providers.
Comment | File | Size | Author |
---|---|---|---|
#10 | 3027569-7.x-3.x-10.patch | 4.33 KB | markhalliwell |
#8 | 3027569-8.x-3.x-8.patch | 2.08 KB | markhalliwell |
Comments
Comment #2
just_like_good_vibesComment #3
markhalliwellActually, I think
ProviderBase::requestJson
should just be made to always return an array. There's no need to actually do anything special on an error.Comment #4
just_like_good_vibesyes you are right, that's another good solution. would you like me to update the patch?
Comment #5
markhalliwellSure
Comment #6
markhalliwellComment #7
markhalliwellComment #8
markhalliwellComment #10
markhalliwellComment #12
markhalliwellI want to go ahead and release this, but I'd appreciate if someone can verify these are actually working for you (for both versions). I just simply did code editing in my IDE.
Comment #13
AaronBaumanI got this error when rebuilding cache on a site with internet access, so not necessarily limited to that scenario.
Confirming latest dev fixes it.
Comment #14
vorapoap CreditAttribution: vorapoap as a volunteer commentedAfter make the function return [] instead of nothing
I still encounter this error.
https://stackoverflow.com/questions/31107851/how-to-fix-curl-35-cannot-c...
It doesn't crash Drupal, but made the rebuilding cache process so slow.......
Comment #15
vorapoap CreditAttribution: vorapoap as a volunteer commentedFor those experience the very cache rebuilding after solving this issue.
According to the stackoverflow link above, I have managed to solve the problem by adding this to settings.php
$settings['http_client_config']['curl'][CURLOPT_SSL_CIPHER_LIST] = 'ecdhe_rsa_aes_128_gcm_sha_256';
Comment #16
markhalliwellIt should be noted that the new jsdelivr API now requires the code here to do multiple requests (one for each version); whereas the previous API could be done in as little as two. This is not something we have control over and they do not plan on adding this convenience back to their API.
Also, for the record, the act of simply rebuilding the cache does not trigger this code. This only gets built when you actually visit the page. Thus, if you rebuild the caches (while on this page) you may experience a longer "cache rebuild time" as it first has to rebuild the caches and then do the multiple requests and process each received JSON data.
Comment #17
vorapoap CreditAttribution: vorapoap as a volunteer commentedmarkcarver
FYI, I noticed the very slow cache rebuilding time after recent upgrade to the latest version of Drupal 3.6.7, the PHP Debugger found the bottle neck in this requestJson thing.
When I say 'slow'..it is longer than 10 secs (it was used to be under 2-3 secs)
Comment #18
vorapoap CreditAttribution: vorapoap as a volunteer commentedFYI, Putting this inside settings.php causes problem to other request (where ecdhe_rsa_aes_128_gcm_sha_256 is not needed ).
This is needed to be put in requestJson function only.
Comment #19
AvO WebWorks CreditAttribution: AvO WebWorks commented@markcarver for drupal 7.63 after applying the patch I now get this error:
Parse error: syntax error, unexpected ':' in .../sites/all/themes/bootstrap/includes/cdn.inc on line 35
php 5.2.17
Comment #20
markhalliwell#2265819: [bootstrap][policy][7.x-3.x] PHP 5.2 no longer supported
Comment #21
AvO WebWorks CreditAttribution: AvO WebWorks commentedThanks @markcarver I also pointed this out to the client. I really appreciate all your hard work in the Drupal community and your work on the bootstrap theme.
Comment #22
nor sairi CreditAttribution: nor sairi as a volunteer and commented#10 tested and and just follow #15. its work for me
Comment #23
drugan CreditAttribution: drugan as a volunteer commentedFor me just this fixed the issue.
The reason was that the $this->requestJson("https://data.jsdelivr.com/v1/package/npm/$package") returned NULL, hence the error. I think we should never rely that return will be an array.
Comment #24
markhalliwellThis has already been fixed...
Comment #25
esteinborn CreditAttribution: esteinborn commentedI can confirm this patch does fix the JSDelivr error.
I can also confirm that this patch does make the first visit after a cache rebuild take a dramatically longer time to render. (from ~10 seconds to 1:25)
Is there any way to reduce that? Possibly rely on the "CDN Provider" setting in the theme so when it's set to "none" it will skip the JSDelivr checks?
Comment #26
drugan CreditAttribution: drugan as a volunteer commentedFor me it was I had a slow internet connection and after each attempt to flush caches on the site where I develop a Bootstrap based theme there was a crash. Debugging the issue I've discovered that $this->requestJson("https://data.jsdelivr.com/v1/package/npm/$package") returns
NULL
instead of the array, soNULL + ['versions' => []]
will result in the same error again and again.I think it does not break anything in the code if we ensure that return type is always an array.
Comment #27
markhalliwellI was mistaken in #16, this code does get hit after a cache rebuild. I forgot that it does trigger the CDN assets when altering the library info:
https://drupal-bootstrap.org/api/bootstrap/src%21Plugin%21Alter%21Librar...
https://drupal-bootstrap.org/api/bootstrap/src%21Plugin%21Provider%21JsD...
And because of the cache clear, the JsDelivr provider plugin definition has to be rebuilt, which is where the API request code resides:
https://drupal-bootstrap.org/api/bootstrap/src%21Plugin%21Provider%21JsD...
I've created the above related issue to try and tackle restructuring some of this code so it doesn't take unnecessary hits to the API.
---
@drugan, yes, that is what the commits #9 and #11 did: alway return an array (see the corresponding patches above those commits). This specific issue has already been fixed. There is no need to continue repeating something that has already been taken care of.
Comment #28
markhalliwellAlso, re: #14 and #15, if you're having issues with cURL/SSL resolving, that is an issue specific to your server. I recommend attempting to upgrade some of your server components (e.g. cURL and OpenSSL) which would likely resolve your issues. If you cannot, I'd recommend getting a different host.
Comment #29
gge CreditAttribution: gge commentedDrugan's patch (#23) was the solution that worked for me, using Bootstrap 8.x-3.17.
Thank you~
Comment #30
lazar.lehel CreditAttribution: lazar.lehel commentedThe #23 works!
Comment #31
markhalliwellComment #32
markhalliwellComment #33
markhalliwellComment #34
gdaw CreditAttribution: gdaw as a volunteer commentedPatch from #8 fixed the issue for us.
Comment #35
Sajjad Ali CreditAttribution: Sajjad Ali commentedPatch #10 works for me.Thanks
Comment #36
terminalc CreditAttribution: terminalc commentedCan confirm this occurred on a machine that did have internet. Applied patch #10, seems to be working. Page loading time does seem to be impacted but have not implemented any settings.php changes yet. Thanks for the patch, cashiers would not have been happy this morning.
Comment #37
bwoods CreditAttribution: bwoods as a volunteer commentedPatch #8 worked for me as well - thanks!
Comment #38
blur702Patch #8 worked great! Thank you.
Comment #39
jedgar1mx CreditAttribution: jedgar1mx commentedQuick question, would this error cause the entire site to go down?
Comment #40
esteinborn CreditAttribution: esteinborn commentedWithout the patch in #8, my entire site was unavailable, yes.
Comment #41
jedgar1mx CreditAttribution: jedgar1mx commentedThank for the response @esteinborn, did your site go down after 22 Jan 2019? or did stayed up for a while before it went down?
Comment #42
esteinborn CreditAttribution: esteinborn commentedIt went down as soon as I pushed the latest version.
Comment #43
markhalliwellJust a reminder: please test code updates on development sites prior to deploying them to production servers.
That being said, #3031415: Overhaul CDN Providers API just landed in 8.x-3.x-dev and I'm working on the 7.x-3.x backport now. Please help test this code now before a release is made. I always test locally on a real site, but it doesn't mean I can't miss something (as is apparent with this issue).
It should help (a lot) with some of the fundamental flaws that became apparent in the CDN Provider API after the jsDelivr API switch happened in #2657138: Refactor providers to utilize new data.jsdelivr.com API.
I know that people are anxious to get this specific issue out the door, but there are a few things I want to get done prior to another release (especially with the security release that was made today).
Comment #44
jedgar1mx CreditAttribution: jedgar1mx commentedDoes it matter whether I had CDN Provider set to `none`? Would it still break the site? Thanks
Comment #45
markhalliwellChange record done, please review: https://www.drupal.org/node/3032924
Comment #46
strelkovandreyvalerievichI apologize that I write after closing, because I have the same problem with Drupal 7 in the offline intranet network, updated Bootstrap to dev version of February 14 - the problem disappeared. I understand correctly that these fixes will appear in the near future in Bootstrap version 7.24?
(p.s. only noticed that after upgrading to the dev version when logging in the settings of my subtheme reports the following error:
after I change CDN Provider to Custom-stops writing about the error, I change back to jsDelivr-also does not write. It turns out that he writes about the error before the first CDN provider configuration)
Comment #47
esteinborn CreditAttribution: esteinborn commentedCan confirm that patch #3 from issue: https://www.drupal.org/project/bootstrap/issues/3031415 fixes the long cache rebuilding times after applying patch #8 from this issue.
Reduced cache rebuild time from 1:25 to :05 in my local development environment.
Thanks @markcarver
Comment #48
jedgar1mx CreditAttribution: jedgar1mx commented@markcarver if I'm reading this correctly:
I shouldn't have been affected since I don't use a custom CDN. Is this correct?
Comment #49
drugan CreditAttribution: drugan as a volunteer commentedIn my case I had no cdn at al in my sub-theme settings but anyway got a a crash every time trying to flush the caches:
Comment #50
markhalliwellNo, that is not correct.
Change records are not an indication of whether someone has been affected by recent changes.
In fact, everyone was affected by recent commits/releases, regardless if they used a CDN or not.
This was primarily due to the way the code was structured.
---
Change records are intended for individuals who use public APIs that have changed.
The sentence you're referring to in the change record is for users who don't implement their own CDN provider (using APIs).
I was simply acknowledging that not everyone will really care about this change and was giving them an easy out.
If you don't use the CDN (set to "None"), then you don't have to worry about the change record.
I have updated the change record verbiage to be a little more explicit about that.
Comment #51
markhalliwellThe errors in #46 were also fixed in the latest patch/commit of #3031415: Overhaul CDN Providers API.
Comment #52
strelkovandreyvalerievichGreat! Thanks Mark! Waiting for patch for D7 =)
Comment #53
markhalliwellMore work done: https://www.drupal.org/project/bootstrap/issues/3031415#comment-12975388
Working on backporting that work to 7.x-3.x, but please go ahead and test 8.x-3.x-dev as well.
Comment #54
jedgar1mx CreditAttribution: jedgar1mx commentedThanks for the clarification @markcarver
Comment #55
dudleyc CreditAttribution: dudleyc commentedIs there a plan for a new release with this fix and #3031415 in please ?
Comment #56
markhalliwell@dudleyc, see https://www.drupal.org/project/bootstrap/issues/3031415#comment-12978631
Comment #57
xamount CreditAttribution: xamount as a volunteer commentedI can confirm that the patch at #8 worked for me.
In my case, I didn't need this patch for DEV or STAGING servers. These servers all had correct ssl set up and access to the Internet.
However, in my local, composer would never run properly due to it being in an internal network problem hence preventing composer from using ssl correctly so I have to get outside of my local network to run composer correctly everytime. (This problem was specific to my local environment), however, my local composer problem was similar to "using bootstrap on a Drupal 8 website without Internet access" as in the body of this original issue.
So essentially, after I upgraded to Bootstrap 3.17, my local install of Drupal 8 would always get WSOD when viewing as anonymous user only.
However on DEV/STAGING, the exact same site would work as anonymous users.
In both my local and DEV/STAGING, only logged in users can access the site after upgrading to Bootstrap 3.17. Although in both cases, when logged in as admin, the Bootstrap theme was never listed at admin/reports/updates until I applied the patch.
After installing the patch at #8, everything now works and I have included this patch in my composer.json file until the developer of this module cuts a new stable release including this patch.
Took me days to figure out this btw.
Comment #58
ashok.gharpankar CreditAttribution: ashok.gharpankar as a volunteer commentedPatch #8 worked well for me! Thank you.
Comment #59
chri5tia CreditAttribution: chri5tia commentedWhen trying to apply the patch in #8 for Drupal 8.6.12 and bootstrap 3.17, I get the following:
The WSOD issue I am trying to fix is the following in watchdog:
I had to downgrade to 8.x-3.16.
Comment #60
Déjà vu CreditAttribution: Déjà vu as a volunteer commentedPatch #8 worked for me as well. thank you!
Comment #61
wahido CreditAttribution: wahido commented@just_like_good_vibes #2 Worked for me..thanks
Comment #62
lolmanKD CreditAttribution: lolmanKD as a volunteer commentedFor Drupal 7, this Patch https://www.drupal.org/files/issues/2019-01-24/3027569-7.x-3.x-10.patch partially worked for me, but it seems like, some of my JS libraries are not working properly.
Comment #63
denix CreditAttribution: denix as a volunteer commented#10 worked for me on my D7 install
Comment #64
DanielVezaI could be mistaken but it looks like there isn't a new release with this commit in it. All of our D8 sites go down on cache clear now without this patch, since it appears jsdelivr is broken/gone/something else. I imagine everyone else running a stable version of bootstrap will be going down as well.
Could be time for a new release.
Comment #65
Upchuk CreditAttribution: Upchuk as a volunteer commentedThere is a patch in #3048414: Bootstrap jsDeliver CDN endpoint broken for 8.x-3.17.
Comment #66
xurizaemonAlso saw the jsdelivr issue - it's resolved now. Reported to them via Twitter.
https://twitter.com/jsDelivr/status/1118055257542729728?s=19
Comment #67
markhalliwell@DanielVeza, see #2852156: Move "overrides" source files and generated CSS to separate project
Comment #68
xurizaemonI realise this patch in #8 has already been merged and Mark has asked in #12 above to confirm the fix so he has confidence in a new release.
Tested this to confirm it resolves situations like yesterday's JsDelivr outage:
Applied patch from #8 https://www.drupal.org/files/issues/2019-01-24/3027569-8.x-3.x-8.patch
Relating in several other issues that might help to lead people here - I believe these all trace back to the same thing fixed here, which is
$this->requestJson($url, $params) + ['versions' => []];
throwing "unsupported operand types" when the result of requestJson is not the expected array.
Thanks Mark!
Comment #69
kunal_singh CreditAttribution: kunal_singh commented#2 worked for me. Thanks
Comment #70
peetrovich CreditAttribution: peetrovich commented#10 solved problem for my D7.66.
Thanks!
Comment #71
Joran Lafleuriel CreditAttribution: Joran Lafleuriel commented#10 saved my life ! Many thanks...
Comment #72
Anaconda777 CreditAttribution: Anaconda777 as a volunteer commentedI can't patch the latest version 7.x-3.25 with the #10
What should I do?
Sites are down.
Comment #73
markhalliwellThat's because it was already committed (see the next comment #11) and included with 7.x-3.25.
Comment #74
mchoffa CreditAttribution: mchoffa commentedPopped up for me today when a user cleared cache on a site. #10 fixed it and now it's all up to date.
Comment #75
jorgediazhav CreditAttribution: jorgediazhav as a volunteer commentedAfter clearing the caches, a couple of minutes ago, everything went down.
I confirm #10 fixed the issue for me.
Comment #76
gdev2018 CreditAttribution: gdev2018 commentedafter update the module to 3.19 I can't apply #8
Comment #77
asuresh CreditAttribution: asuresh commentedWhile doing (NULL+ Array), PHP will throw Operand type fatal error. This patch will fix operand type issue
Comment #78
markhalliwellPlease just update to the latest version. This has long since been fixed.
Comment #79
markhalliwell