1

TLDR EDIT: Civi getURL generated <site>/civicrm/<resourcepath>?r=<key> doesn't serve <site>/<resourcepath> Should the file be coming from civi with a key or not go through civi?

I have a fairly new LAMP machine with CiviCRM 5.9.1 installed in Wordpress 5.0.3 with the plugin installer. I am getting a 404 when a contribution page is trying to pull in civicrm_stripe.js for the stripe payment processor.

I can load the file at <site>/wp-content/uploads/civicrm/ext/com.drastikbydesign.stripe/js/civicrm_stripe.js (where I probably should get a 404) but get a 404 on <site>/civicrm/wp-content/uploads/civicrm/ext/com.drastikbydesign.stripe/js/civicrm_stripe.js?r=<key>

Is there any way to see why the resource isn't being served?

2
  • Note also that CiviCRM 5.9.0 has some rather nasty bugs, you'll definitely want 5.9.1! Jan 31, 2019 at 16:19
  • Good to know - I didn't see the latest release blog only does major releases.
    – Derek S.
    Jan 31, 2019 at 21:23

2 Answers 2

1

Welcome to SE! Check your Extension Resource URL at Administer > System Settings > Resource URL's

A typical WP install would show the Extension Resource URL as [civicrm.files]/ext where [civicrm.files] is https://example.org/wp-content/uploads/civicrm

2
  • I believe it is correct - the extension php is loading, but the when civi is asked to serve the resource it doesn't. I guess specifically, CRM_Core_Resources::singleton()->addScriptFile('com.drastikbydesign.stripe', 'js/civicrm_stripe.js') is not working.
    – Derek S.
    Jan 31, 2019 at 15:37
  • In the end I could get this to work by removing civi from the path and I'll hope that's right! :) Thanks.
    – Derek S.
    Feb 4, 2019 at 2:15
2

WordPress/CiviCRM can have trouble resolving tokens like [civicrm.files] if you have a symlink in your path.

If you're having resource URL issues, I recommend replacing the tokens with absolute paths (with no symlinks) in Administer » System Settings » Directories as well as checking Administer » System Settings » Resource URLs as Aidan suggests. It sounds like your CIVICRM_UF_BASEURL is set correctly in civicrm.settings.php but it never hurts to check.

A permanent solution for this is underway: See https://lab.civicrm.org/dev/core/issues/1497.

3
  • Jon, do you have a link to documentation (or issue queue) regarding "WordPress/CiviCRM can have trouble resolving tokens like [civicrm.files] if you have a symlink in your path."?
    – TwoMice
    Dec 19, 2019 at 22:06
  • 1
    Can I link to this answer? :) This is something I learned from Kevin C., who researched it extensively. I can't say for sure if it's documented anywhere else, but you can talk to him about the bloody details Dec 19, 2019 at 22:53
  • Issue created, with reference to this SE question and to today's MM discussion with Kevin C. lab.civicrm.org/dev/core/issues/1497 (I suggest adding this to the answer for improved visibility).
    – TwoMice
    Dec 20, 2019 at 19:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.