locked
Why is appSettings.STORAGE_ACCOUNT_NAME undefined? RRS feed

  • Question

  • I keep getting undefined when I try to access the storage account name, even though I set it from the management portal.

    I keep getting back as host undefined.blob.core.windows.net

    this is the beginning of my insert script

    var appSettings = require('mobileservice-config').appSettings;
    
    function insert(item, user, request) {
    
        var accountName = appSettings.STORAGE_ACCOUNT_NAME;
        var accountKey = appSettings.STORAGE_ACCOUNT_ACCESS_KEY;
        var host = accountName + '.blob.core.windows.net';

    Friday, November 28, 2014 5:19 AM

Answers

  • Hi Sal_S,

    First, I suggest that you can check if your appSettings file appear similar  to the  below:

    {
    ["STORAGE_ACCOUNT_NAME"]:"storage account name",
    
    ["STORAGE_KEY"]:"stroage access key"
    }
    

    Then, I suggest that you can try the code snippet below :

    var accountName = appSettings.get("STORAGE_ACCOUNT_NAME"); 
    var accountKey = appSettings.get("STORAGE_ACCOUNT_ACCESS_KEY");
    var host = accountName + '.blob.core.windows.net';
    

    For more information about how to use nodejs to connect storage,I suggest that you can refer to the tutorial below:

    http://azure.microsoft.com/en-us/documentation/articles/storage-nodejs-use-table-storage-web-site/

    Best Regards,

    Kevin Shen.

    Monday, December 1, 2014 9:29 AM

All replies

  • Hello Sal_S,

    Thank you for reaching out to us. We am currently researching to gather more information with regards to your request.  We shall revert back to you with an update at the earliest.  Sincerely appreciate your patience.

    Thanks,
    Syed Irfan Hussain

    Friday, November 28, 2014 12:26 PM
  • Hi Sal_S,

    First, I suggest that you can check if your appSettings file appear similar  to the  below:

    {
    ["STORAGE_ACCOUNT_NAME"]:"storage account name",
    
    ["STORAGE_KEY"]:"stroage access key"
    }
    

    Then, I suggest that you can try the code snippet below :

    var accountName = appSettings.get("STORAGE_ACCOUNT_NAME"); 
    var accountKey = appSettings.get("STORAGE_ACCOUNT_ACCESS_KEY");
    var host = accountName + '.blob.core.windows.net';
    

    For more information about how to use nodejs to connect storage,I suggest that you can refer to the tutorial below:

    http://azure.microsoft.com/en-us/documentation/articles/storage-nodejs-use-table-storage-web-site/

    Best Regards,

    Kevin Shen.

    Monday, December 1, 2014 9:29 AM