1

I am testing a simple lightning component which uses 3rd party js loaded as static resource. Originally I made in in a traiheadplayground. It is a sigle component and in app that only includes that component. I tested it there properly and then I tried same outside of the playgound - I got error:

Action failed: c:mycmp$controller$jsLoaded [Access denied: {"from":{"namespace":"c"}}]

Search showed that problem is the lockerservice, so I switched API version to 39 (both app and component) and tried again - no luck. Then I was trying different combinations of api version and my code. And eventually I got to the point when the app was in the initial state (same resource, api version 42, all of my code enabled as initially) and it just worked!

I was baffled, I uploaded same static resource under different name, used it in component - exception appeared. So now there are 3 states I am testing:

// works
<ltng:require styles="{!$Resource.myres + '/cmp.min.css'}"
              scripts="{!$Resource.myres + '/cmp.js'}"
// throws access denied error
<ltng:require styles="{!$Resource.myres1 + '/cmp.min.css'}"
              scripts="{!$Resource.myres1 + '/cmp.js'}"
// throws access error too, from js code!
<ltng:require styles="{!$Resource.myres1 + '/cmp.min.css'}"
              scripts="{!$Resource.myres + '/cmp.js'}"

resources are identical - I uploaded it twice with different names. static resource tab shows size is equal. but one doesn't work.

I have a feeling that API version is not updated instantly and maybe even somehow cached for resource/cmp combination? Has anyone experienced this before? What could I try understand this issue?

  • This is bit funny. Are you on Summer 18? – Pranay Jaiswal Jun 1 '18 at 11:07
  • I am using trial and haven't specified any version. I am using default I guess, not sure what is it. – snooopcatt Jun 4 '18 at 11:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.