I'm trying to use aura storage in an app included from a VF page, but I have the following error. Same code works well for a standalone .app

Uncaught TypeError: $A.$clientService$.$initHost$ is not a function throws at https://xxxxxxx-developer-edition.eu11.force.com/distributor/auraFW/javascript/-Nl7t7IjS5oiqOIuVwZRSw/aura_proddebug.js:17270:24

Sample app code :

<aura:application access="GLOBAL" 
                  description="Only used for visualforce page javascript inclusion of main big component">
    <aura:dependency resource="c:MyMainBigComponent"/>


<aura:component isTemplate="true" extends="aura:template" description="App template to initialize storage">
    <aura:set attribute="auraPreInitBlock">
        <!-- Note that the maxSize attribute in auraStorage:init is in KB -->
        <auraStorage:init name="actions" 
                          maxSize="2048" />

Sample of including vf page

<apex:page sidebar="false" showHeader="false" standardStylesheets="false"
       cache="false" applyBodyTag="false" applyHtmlTag="false"> 

    <apex:includeLightning />
    <div id="lightningvfDIV" style="min-height: 100% !important;display:block;"/>

            $Lightning.use("c:MyAppForVfPage", function() {
                                           function(cmp) {
                                              console.log('Page includer initialized'); 


Issue is specific to ltng:outApp's template not providing the environment that auraStorage:init is expecting.

I have opened bug W-3451404 to track this if you wan to reference this in any communications with Salesforce support.

  • I see too many bugs to bother SF support with them each time, I fully trust u to take them in account, many thanks for your reactivity Doug :) – Nicolas Vuillamy Nov 4 '16 at 11:21

If it's any help Nicolas if you change the init to be

<auraStorage:init name="actions" 
                          maxSize="2048" />

Then the error is removed. I.e. I changed the persistent and secure values. The persistent setting doesn't seem to work for me; ie if I refresh the page then it seems to skip the cache so that currently will not be a problem. However the cached data will be insecure which might be a bigger issue for you.

  • 1
    It doesn't trigger the inital crash but, it triggered ... unavailability of $Resource references (err 503 when getting bootstrap.css !) :/ And in the console I still see : "Uncaught error in $A.run() [$A.$clientService$.$initHost$ is not a function]" So i'll wait for Doug's fix :) – Nicolas Vuillamy Nov 7 '16 at 18:43

Your Answer

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

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