locked
how to debug the Azure storage. RRS feed

  • Question

  • I am sending a Table.service query and it is sending 2oo OK with no data. I have seen a similar question in forms with no answers.

    How do we debug if the message reached the Azure storage (or) not ? and what is the issue it is having in processing it.

    example: if it is hbase/Mongo we can increase the log level, see what execatly is the issue with the Request.

    similarly, is there a way in Azure storage to set the log levels and see what was the issue.

    Saturday, December 1, 2012 10:03 PM

Answers

  • Thanks Glenn for the excellent support and suggestions in helping in fixing this issue.

    ==

    Based on the suggestions from Glenn  the following this are done which fixed this issue.

    Upgraded to nodejs to v0.8.15

    and upgraded the azure -package using the npm.

    The same Program that Gaurve has posted in one of the reply worked "as is " after upgrading the modules.

    ==

    • Marked as answer by New user123 Sunday, December 16, 2012 4:32 AM
    Sunday, December 16, 2012 4:32 AM
  • If you're receiving 200 (OK) status code that means there was no error in your request and table service was able to process it correctly. As to why you didn't get any records back, please check the response sent by table service through utilities like Fiddler. Most likely there could be two reasons:

    1. Table service did not find any matching records.

    2. Table service did not find any matching records in a Partition. If that's the case then you should see 2 headers from table service: x-ms-continuation-NextPartitionKey and x-ms-continuation-NextRowKey. Take a look at this link: http://msdn.microsoft.com/en-us/library/windowsazure/dd135718.aspx for more details.

    Hope this helps.

    Sunday, December 2, 2012 4:24 AM

All replies

  • If you're receiving 200 (OK) status code that means there was no error in your request and table service was able to process it correctly. As to why you didn't get any records back, please check the response sent by table service through utilities like Fiddler. Most likely there could be two reasons:

    1. Table service did not find any matching records.

    2. Table service did not find any matching records in a Partition. If that's the case then you should see 2 headers from table service: x-ms-continuation-NextPartitionKey and x-ms-continuation-NextRowKey. Take a look at this link: http://msdn.microsoft.com/en-us/library/windowsazure/dd135718.aspx for more details.

    Hope this helps.

    Sunday, December 2, 2012 4:24 AM
  • Thanks Gauvrav.

    To Isolate the problem , I did  a select ().from (table), with out any partition key.

    If I use Azure storage explorer I am able to see all the entries.

    I have set the log level to DEBUG on my azure and got the following output:

    ==

    { error: null,
      response:
       { isSuccessful: true,
         statusCode: 200,
         body: { feed: [Object] },
         headers:
          { 'cache-control': 'no-cache',
            'transfer-encoding': 'chunked',
            'content-type': 'application/atom+xml;charset=utf-8',
            server: 'Windows-Azure-Table/1.0 Microsoft-HTTPAPI/2.0',
            'x-ms-request-id': '457xxxxxxxxxxxxxxxxxxxxxxxxxxx',
            'x-ms-version': '2011-08-18',
            date: 'Sun, 02 Dec 2012 04:30:42 GMT' },
         md5: 'xxxxx==' } }

    ==

    This is between by VM and the Azure storage. you asking me to keep sniffer on my VM?

    Is there no way we can analalyse this issue?

    1) PUT works

    2) GET from  azure explorer does work and not from: (node js with azute storge)

     tableService.queryEntities(query, function(error, entities)..



    • Edited by New user123 Sunday, December 2, 2012 7:19 AM
    Sunday, December 2, 2012 7:17 AM
  • Hi,

    As I said in your another thread, you can try with the help using node-inspector to debug the app.

    http://blogs.msdn.com/b/timart/archive/2012/07/21/debugging-node-js.aspx

    Feel free to come back, if still having the problem.

    Thanks,


    QinDian Tang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, December 3, 2012 7:43 AM
  • Thanks for the reply.

    I used sniffer and was able to see the reponse that it does not have any objects.( Message is postedin the above post)

    This debugger is used to analyse in the program.

    But my issue is Azure storage is not liking it..

    2) how to debug on Azurestorage? and proceed. I was looking at some server(Storage Logs) or something like that 


    Monday, December 3, 2012 6:33 PM
  • Hi,

    I suggest you can use Fiddler:

    http://sepialabs.com/blog/2012/02/17/profiling-azure-storage-with-fiddler/

    Other choices you may want to know:

    http://www.windowsazure.com/en-us/develop/net/best-practices/troubleshooting/

    http://msdn.microsoft.com/en-us/magazine/ff714589.aspx

    Thanks,


    QinDian Tang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Tuesday, December 4, 2012 2:31 AM
  • Hi,

    I am able to see the sniffer  logs looks I can see my table responses  in the response it sends

    but when I do : 

       var query = azure.TableQuery.select().from('sampletable');

       tableService.queryEntities(query, function(error, entities){

    I am getting entities as Null.

    am I mising anything

    Wednesday, December 5, 2012 6:44 AM
  • Any reply on this will be really appreciated
    Thursday, December 6, 2012 1:59 AM
  • Hi,

    Do you have data in table? You can check the storage emulator to see if it has data. I think if it has data, the query won't return null (such a simple query). If it has no data, you may check the code for creating table and saving data to table. I think you can easily find the tutorial for doing that.

    Something like returning null won't leave anything valueable in log tracing, but it is not a error happens. So I think first you need to ensure the data access process is right.

    Thanks,


    QinDian Tang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, December 6, 2012 5:23 AM
  • Thanks for reply.

    1. I have data in the table that is the reason why when I try to connect from the stroage explorer I was able to see.

    2. The same simple code works locally.

    I tried and checked to see that 200 OK from storage is having the data in xml.

    but

       var query = azure.TableQuery.select().from('sampletable');

       tableService.queryEntities(query, function(error, entities){

    I am getting entities as Null.

    This is the problem I am facing and was blocked.....

    Thursday, December 6, 2012 5:35 AM
  • Hi,

    Check the storage account region is the same one to the region you deploy the aplication.

    Thanks,


    QinDian Tang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, December 6, 2012 5:41 AM
  • Hi.

    They are in the same region .

    As I said I was able to see in the 200 OK response  for HTTP GET for the table.

    But 

       var query = azure.TableQuery.select().from('sampletable');

       tableService.queryEntities(query, function(error, entities){

    I am getting entities as Null.

    looks entities is not getting the values..I was looking how to debug this and also where I can find the implementation details how entities get populated 

    Thursday, December 6, 2012 5:57 AM
  • I just tried the following code (sorry I'm a newbie with node.js) and was able to get the list of entities from the table. I ran this code on my local computer but it was connecting to a cloud storage account:

    var azure = require('azure');
    
    var accountName = '<my cloud storage account name>';
    var accountKey = '<storage account key>';
    
    var tableService = azure.createTableService(accountName, accountKey);
    var query = azure.TableQuery
        .select()
        .from('<Table Name>');
    tableService.queryEntities(query, function(error, entities){
        if(!error){
            //entities contains an array of entities
    		console.log(entities);
        }
    	else
    	{
    	console.log(error);
    	}
    });

    Try running this code from your local computer against cloud storage and see if you're able to fetch the entities.

    Hope this helps.

    Thursday, December 6, 2012 6:03 AM
  • Thanks Guvrav. I am able to run the same program as is in the lock computer . only issue is with the cloud.

    localhost returns the entities but when kepyt in cloud it returns noting

    Thursday, December 6, 2012 6:11 AM
  • your same program also does not return anything in entities

    Thursday, December 6, 2012 6:20 AM
  • Is it possible for you to share the complete code of your project (removing any sensitive information like account name/keys etc.)? Or you could try create another sample project which uses this code. We can try running it here our cloud services application.
    Thursday, December 6, 2012 6:23 AM
  • Actually I tried to decode the 200 OK..it looks good, in 200 Ok I am able to see the table

    ==

    <?xml version="1.0" encoding="utf-8" standalone="yes"?>
    <feed xml:base="http://sample.table. core.windows.net/" xmlns:d="http://schemas.microsoft.com/ado/2007/08/dataservices" 
          xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns="http://www.w3.org/2005/Atom">
     <title type="text">sampletables</title>  
     <id>http://sample.table.core.windows.net/sampletables</id>
     <updated>2012-12-06T06:37:22Z</updated>  
     <linkrel="self" title="sampletables"href="sampletables" /> 
     <entry m:etag="W/&quot;datetime'2012-12-06T04%3A31%3A05.7595732Z'&quot;">   
     <id>http://sample.table.core.windows.net/sampletables(PartitionKey='1111111111',RowKey='tempp')</id>  
     <title type="text"></title>   
     <updated>2012-12-06T06:37:22Z</updated>   
     <author><name /></author><name />
     </author><link rel="edit" title="sampletables" href="sampletables(PartitionKey='1111111111',RowKey='tempp')" />
     <category term="sample.sampletables" scheme="http://schemas.microsoft.com/ado/2007/08/dataservices/scheme" />   
     <content type="application/xml">     
     <m:properties><d:PartitionKey>1111111111</d:PartitionKey>       
     <d:RowKey>tempp</d:RowKey><d:Timestamp m:type="Edm.DateTime">2012-12-06T04:31:05.7595732Z</d:Timestamp>
     <d:Date>Fri Jul 20 2012 00:00:00 GMT+0000(UTC)</d:Date>
     <d:info>-117.117388</d:info>
     </m:properties>   
     </content> 
     </entry> 

    I could not post the code thats why I have to do this ....

    I tried the same snip you provided me and got this 200 OK...


    • Edited by New user123 Thursday, December 6, 2012 7:00 AM
    Thursday, December 6, 2012 6:57 AM
  • I am trying the same example that you have pasted with the key and account name as my cloud and table name..still see null

    Please run your sample snipp with a cloud and not with localhost..


    • Edited by New user123 Thursday, December 6, 2012 7:20 AM
    Thursday, December 6, 2012 7:18 AM
  • Hi,

    It is really strange. Usually if it returns null, which means the query expression is not met according to the table data. If the connection is wrong, it will throw error. You just return null, so the connection is ok and your query is such simple. It won't be anything wrong.

    You can add the where clause to filter some specific entity by PartitionKey or some properties to see if it gets data.

    Thanks,


    QinDian Tang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, December 6, 2012 7:30 AM
  • I tried that also . than I taught not keeping where cluase so that it wil get everything and atleast I can debug from there ....

    My issue is as I posted the snip I can see the 200 ok with the payload but the data is not read by the API..so this is defintely a issue with a API with cloud..

    :-) I really feel azure is difficult to debug .....

    can you try with cloud the snip given by Gaurav ? is it working for you

    Thursday, December 6, 2012 7:35 AM
  • HI,

    Can you please provide me where I can get the documentation for 

     var query = azure.TableQuery.select().from('sampletable');

       tableService.queryEntities(query, function(error, entities)

    I want to know what query wil have and what is the criteria with which it will update the entities....


    • Edited by New user123 Thursday, December 6, 2012 8:38 AM
    Thursday, December 6, 2012 8:33 AM
  • I created a simple azure website using node.js and table storage to test this thing out and it worked perfectly fine for me. You can try it here: http://msdnforumtest1.azurewebsites.net/

    I took your sample data and created a table in my storage account and accessed it using the following code:

    var fs = require('fs');
    if (!fs.existsSync) {
      fs.existsSync = require('path').existsSync;
    }
    
    var azure = require('azure');
    var http = require('http');
    var port = process.env.PORT || 1337;
    var accountName = '<account name>';
    var accountKey = '<account key>';
    
    http.createServer(function(req, res) {
      res.writeHead(200, { 'Content-Type': 'text/html' });
    var tableService = azure.createTableService(accountName, accountKey);
    var query = azure.TableQuery
        .select()
        .from('sampletables');
    tableService.queryEntities(query, function(error, entities){
        if(!error){
            //entities contains an array of entities
    		var responseBody = '<table border=\'1\' cellpadding=\'2\' cellspacing=\'0\'><tr><td>PartitionKey</td><td>RowKey</td><td>Date</td><td>Longitude</td></tr>';
    		for (var i=0; i<entities.length; i++)
    		{
    			responseBody += '<tr><td>' + entities[i].PartitionKey + '</td><td>' + entities[i].RowKey + '</td><td>' + entities[i].Date + '</td><td>' + entities[i].Longitude + '</td></tr>';
    		}
    		responseBody += '</table>';
    		res.end(responseBody);
        }
    	else
    	{
    	res.end(error);
    	}
    });
      //res.end('Hello World\n');
    }).listen(port);

    Do try it out and see if it works for you or not.

    Hope this helps.

    Thursday, December 6, 2012 3:23 PM
  • Thanks Gaurav really appreciate your response and explanation.

    I do have the same problem still.

    I am using VM=> Ubantu.

    I have added the following code to your Program so that I can have both insert and query done by the same script.

     var task = {
                  PartitionKey : "dummy"
    , RowKey : "dummykey"
                , data : "dummydata"
                };
                                   tableService.insertOrReplaceEntity('sampletables', task, function(error){
                                    if(!error){
    console.log("Insert successful");
                                      }
    });


    var query = azure.TableQuery
        .select()
        .from('sampletables');
    tableService.queryEntities(query, function(error, entities){

    I can see that HTTP 200 Ok is having the body but when I do console.log(entities)

    it prints null. Same program works locally .

    what is the env in which you tested ? can you please do that in Linux?

    Thursday, December 6, 2012 11:07 PM
  • You're welcome. I tested it on Windows environment (Windows 8 for local, Azure Websites for Cloud). Unfortunately I've no knowledge about Linux (: however let me try (or find somebody who has experience with Linux/Node.js/Azure Storage).

    Hang in there :)

    Friday, December 7, 2012 4:36 AM
  • Thank you . In LInux also it is the same way as we do in windows ..just the OS is different.

    I feel some issue with the linux API's...I also might be wrong...

    Please let me know when you get to know some thing

    Friday, December 7, 2012 5:00 AM
  • New user123

    Sorry you are having issues. My team builds the azure node module. Can you shoot me a mail, gblock@microsoft.com so we can follow up on this?

    Thanks

    Glenn


    This posting is provided "AS IS" with no warranties, and confers no rights

    Friday, December 7, 2012 6:24 AM
  • Thanks you Glenn, I  have send you a mail to your personal email id with more information.
    Saturday, December 8, 2012 2:32 AM
  • Hi all

    Quick update, this definitely does work in our Ubuntu VMs. I just verified this myself using the same storage account and this node app running on an Ubuntu VM in Azure that I created.

    I am still waiting on you @New user123 to verify on his end. If you are still having issues, we'll work through it.


    This posting is provided "AS IS" with no warranties, and confers no rights


    Tuesday, December 11, 2012 9:39 AM
  • Thanks Glenn for the excellent support and suggestions in helping in fixing this issue.

    ==

    Based on the suggestions from Glenn  the following this are done which fixed this issue.

    Upgraded to nodejs to v0.8.15

    and upgraded the azure -package using the npm.

    The same Program that Gaurve has posted in one of the reply worked "as is " after upgrading the modules.

    ==

    • Marked as answer by New user123 Sunday, December 16, 2012 4:32 AM
    Sunday, December 16, 2012 4:32 AM
  • I'm glad you got the issue resolved :). +1 for Glenn & his team!
    Sunday, December 16, 2012 4:35 AM