GithubHelp home page GithubHelp logo

azure / azure-sdk-for-node Goto Github PK

View Code? Open in Web Editor NEW
1.2K 2.4K 567.0 53.81 MB

Azure SDK for Node.js - Documentation

Home Page: https://github.com/Azure/azure-sdk-for-node#documentation

License: MIT License

JavaScript 100.00% Shell 0.01% Batchfile 0.01% TypeScript 0.01%
javascript azure-sdk nodejs

azure-sdk-for-node's Introduction

Announcing the new Azure SDK for JavaScript

We are excited to announce that we are building a new Azure SDK for JavaScript in a new GitHub repo located here: https://github.com/azure/azure-sdk-for-js.
These packages ship with TypeScript type definitions and have both Node.js and Browser support.

Below are key points regarding deprecation of the packages in this repo and migration to the new packages

  • All of the management plane SDKs (azure-arm-*) and all of the data plane SDKs (azure-*), along with the rollup package azure in this repository, have been deprecated as of March 2023. They have been replaced by the Azure SDK for JavaScript packages.
  • All of the management plane SDKs for the V1 Azure API (Azure Service Management) azure-asm-* will continue to be maintained from the Azure SDK for Node.js repository. We expect customers using these packages to move to Azure Resource Manager API packages at their earliest convenience.
  • To migrate your code from Azure SDK for Node.js to the new Azure SDK for JavaScript, first identify the counterparts in the new SDK and then read our Migration from Node.js packages (azure-sdk-for-node) to JavaScript packages (azure-sdk-for-js) article.

Azure SDK for Node.js

NOTE: This repo is deprecated. All future JavaScript SDKs have moved to Azure SDK for JavaScript. Please see the note above for more information.

This project provides Node.js packages that makes it easy to consume and manage Microsoft Azure Services.

If you are new to Azure and Node.js, see Azure for Node.js developers.

For documentation specific to the Azure SDK Node.js packages, see the Azure Node SDK Reference.

Component Build Status
Management Libraries Build Status
Client Libraries Build Status

Usage

To install an individual Node.js package, look up the package name and use npm to install it into your project.

For example to install the Storage package, you would run:

$ npm install azure-storage

Supported services

This SDK has support for:

  • Azure services
    • These are packages with the naming convention of azure-<servicename>.
    • In the new Azure SDK for JS, the counterparts will have the naming convention of @azure/<servicename>
  • ARM services
    • These are packages with the naming convention of azure-arm-*
    • In the new Azure SDK for JS, the counterparts will have the naming convention of @azure/arm-*
  • Legacy ASM services
    • These are packages with the naming convention of azure-asm-*
    • In the new Azure SDK for JS, there are no counterparts to these packages. Please use the ARM services via packages with the naming convention of @azure/arm-*
  • The roll up package azure
    • Installing this package will result in installing all the packages in this SDK including the helper modules like ms-rest-azure.
    • In the new Azure SDK for JS, there is no counterpart to this. You are encouraged to install only the packages you need.

Documentation

Documentation of the supported SDKs can be found at two places:

  • https://azure.github.io/azure-sdk-for-node - This website primarily provides SDK documentation for
    • ASM based services (azure-asm-*)
    • Older data plane SDKs like azure-sb, azure-scheduler, azure-storage-legacy, azure-monitoring, etc.
    • Runtime SDKs like ms-rest, ms-rest-azure, azure-common
  • https://aka.ms/azure-node-sdk - This website primarily provides SDK documentation for
    • ARM based services (azure-arm-*)
    • Newer data plane SDKs like azure-batch, azure-graph, etc.

Authenticating

There are three ways to authenticate against Azure while using the management plane (azure-arm-*) SDKs and the azure-graph SDK, use this guide to determine which method to use.

Azure service modules

Package Description Documentation
azure-gallery Access to the Azure Marketplace azure-gallery package
azure-graph Access to Azure Active Directory Azure Active Directory modules
azure-keyvault Integrate with Key Vault Azure Key Vault modules
azure-monitoring Azure Monitoring azure-monitoring package
azure-scheduler Create jobs with Azure Scheduler Azure Scheduler modules
azure-servicefabric Azure Service Fabric Azure Service Fabric modules
azure-sb Service Bus Azure Service Bus modules
azure-storage Storage Azure Storage modules
azure-batch Azure Batch processing azure-batch package

Note: If there is a Microsoft Azure service that doesn't have a package yet, open an issue so that we may prioritize it in the backlog.

Azure Resource Management (ARM)

Service Install Command
Advisor npm install azure-arm-advisor
API Management npm install azure-arm-apimanagement
App Insights npm install azure-arm-appinsights
Automation npm install azure-arm-automation
Authorization npm install azure-arm-authorization
Batch npm install azure-arm-batch
Batch AI npm install azure-arm-batchai
Billing npm install azure-arm-billing
CDN npm install azure-arm-cdn
CognitiveServices npm install azure-arm-cognitiveservices
ContainerInstance npm install azure-arm-containerinstance
CosmosDB npm install azure-arm-cosmosdb
Commerce/Usage npm install azure-arm-commerce
Container Registry npm install azure-arm-containerregistry
CustomerInsights npm install azure-arm-customerinsights
Compute npm install azure-arm-compute
Datafactory npm install azure-arm-datafactory
Data Lake Analytics npm install azure-arm-datalake-analytics
Data Lake Store npm install azure-arm-datalake-store
DevTest Labs npm install azure-arm-devtestlabs
DNS npm install azure-arm-dns
DomainServices npm install azure-arm-domainservices
EventGrid npm install azure-arm-eventgrid
EventHubs npm install azure-arm-eventhub
HDInsight npm install azure-arm-hdinsight
HDInsightJobs npm install azure-arm-hdinsight-jobs
Insights npm install azure-arm-insights
IotHub npm install azure-arm-iothub
Key Vault npm install azure-arm-keyvault
Logic Apps npm install azure-arm-logic
Machine Learning npm install azure-arm-machinelearning
Machine Learning Compute npm install azure-arm-machinelearningcompute
Media Services npm install azure-arm-mediaservices
Mobile Engagement npm install azure-arm-mobileengagement
Monitor Management npm install azure-arm-monitor
Notification Hubs npm install azure-arm-notificationhubs
Operations Management npm install azure-arm-operations
Operational Insights npm install azure-arm-operationalinsights
PowerBi Embedded npm install azure-arm-powerbiembedded
RecoveryServices npm install azure-arm-recoveryservices
RecoveryServices Backup npm install azure-arm-recoveryservicesbackup
RecoveryServices SiteRecovery npm install azure-arm-recoveryservices-siterecovery
Redis Cache npm install azure-arm-rediscache
Relay npm install azure-arm-relay
Resource Health npm install azure-arm-resourcehealth
Resource Manager npm install azure-arm-resource
Scheduler npm install azure-arm-scheduler
Search npm install azure-arm-search
ServerManagement npm install azure-arm-servermanagement
Servicebus npm install azure-arm-sb
Service Fabric npm install azure-arm-servicefabric
Storage npm install azure-arm-storage
Storage Import-Export npm install azure-arm-storageimportexport
StorSimple 8000 series npm install azure-arm-storsimple8000series
Stream Analytics npm install azure-arm-streamanalytics
SQL npm install azure-arm-sql
Traffic Manager npm install azure-arm-trafficmanager
Virtual Networks npm install azure-arm-network
Visual Studio npm install azure-arm-visualstudio
WebApps (WebSites) npm install azure-arm-website

Azure Service Management (ASM)

Service Install Command
Compute npm install azure-asm-compute
HDInsight npm install azure-asm-hdinsight
Service Bus npm install azure-asm-sb
Service Manager npm install azure-asm-mgmt
Store npm install azure-asm-store
Scheduler npm install azure-asm-scheduler
SQL Database npm install azure-asm-sql
Storage npm install azure-asm-storage
Subscriptions npm install azure-asm-subscription
Traffic Manager npm install azure-asm-trafficmanager
Virtual Networks npm install azure-asm-network
WebSites npm install azure-asm-website

Base Libraries

Library Install Command
Common Functionality (for ASM & ARM clients) npm install azure-common
Common Functionality for ARM clients generated from Autorest (Generic) npm install ms-rest
Common Functionality for ARM clients generated from Autorest (Azure) npm install ms-rest-azure

Need Help?

Related Projects

License

This project is licensed under MIT and Apache-2.0.

  • "MIT" license is usually used for the client libraries generated using Autorest that are targeting ARM (V2 version of Azure REST API). The license can be found in "LICENSE.MIT.txt" file in this repository.
  • "Apache-2.0" license is usually used for the client libraries generated using an internal code generator that are targeting ASM (V1 version of Azure REST API). The license can be found in "LICENSE.Apache.txt" file in this repository.

Contribute

This project has adopted the Microsoft Open Source Code of Conduct.

For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

If you would like to become an active contributor to this project please follow the instructions provided in Microsoft Open Source Guidelines.

Getting Started Developing

Want to get started hacking on the code, super! Follow the following instructions to get up and running. These instructions expect you have Git and a supported version of Node installed.

  1. Fork it
  2. Git Clone your fork (git clone {your repo})
  3. Move into SDK directory (cd azure-sdk-for-node)
  4. Install all dependencies (npm install)
  5. Run the tests (npm test). You should see all tests passing.

Contributing Code to the Project

You found something you'd like to change, great! Please submit a pull request and we'll do our best to work with you to get your code included into the project.

  1. Commit your changes (git commit -am 'Add some feature')
  2. Push to the branch (git push origin my-new-feature)
  3. Create new Pull Request

Impressions

azure-sdk-for-node's People

Contributors

amarzavery avatar annatisch avatar anuchandy avatar autorestci avatar balajikris avatar blackmist avatar daviddesberg avatar deepakswifty avatar guangyang avatar gucalder avatar huangpf avatar jasonyang-msft avatar jeffreychenmsft avatar jeffwilcox avatar jianghaolu avatar kpajdzik avatar lodejard avatar markcowl avatar matt-westphal avatar ms-alguerra avatar peterblazejewicz avatar qiaozha avatar rikkigibson avatar smithaborkar avatar suwatch avatar vivsriaus avatar williexu avatar xingwu1 avatar xmbms avatar yugangw-msft avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

azure-sdk-for-node's Issues

Improve emulated value checking

L680 return process.env[ServiceClient.EnvironmentVariables.EMULATED] ? true : false;

Should check the type. and not return true if EMULATED is simply set. Example, it could be set to "false"

Allow substring searches

The windows azure tables query does not support substring searches i.e. substring('nikhil', fullname) eq true or some similar format so one can perform a query equivalent to the SQL "like". I am basing the above off the oData spec. but it can take any form as long as the facility to perform substring searches is available.
There are often scenarios, especially around AJAX autocomplete where such a facility is required.
The minimum requirement for this query should be partitionKey. substring should be supported on each attribute in addition to rowKey.
Ideal implementation would be an extension of the query object and response would be an array.

Issue with encoding a queue message result

Wasn't able to lock down a solid repro for this, but it looks like you can get in a state with the queue service where base64 encoding does not work correctly. Here is a stack trace:

if (encStr.charCodeAt(i - 2) == 61) {
^
TypeError: Object # has no method 'charCodeAt'
at Object.decode64 (C:\node-deploy\areader\WorkerRole1\node_modules\azure\li
b\util\base64.js:37:14)
at Function.parse (C:\node-deploy\areader\WorkerRole1\node_modules\azure\lib
\services\queue\models\queuemessageresult.js:70:47)
at C:\node-deploy\areader\WorkerRole1\node_modules\azure\lib\services\queue
queueservice.js:526:55
at Array.forEach (native)
at C:\node-deploy\areader\WorkerRole1\node_modules\azure\lib\services\queue
queueservice.js:525:18
at IncomingMessage. (C:\node-deploy\areader\WorkerRole1\node_modu
les\azure\lib\services\serviceclient.js:230:13)
at IncomingMessage.emit (events.js:88:20)
at HTTPParser.onMessageComplete (http.js:137:23)
at Socket.ondata (http.js:1124:24)
at TCP.onread (net.js:348:27)

Make samples work with relative path OR with npm module

A common pattern is for one to copy our samples and just deploy them. Currently you have to modify code as the Azure module is relatively referenced in the require.

A fix would be to add logic that tries to resolve relative, if not found it does a simple require.

library doesn't work on Heroku

I tried to run the library on Heroku without success since it only supports node v0.4.7 and the azure npm package engine is set to >= 0.6.4

I forked this repo and published an npm package 'azure-0.4.7' to perform a test on Heroku and it seems to be working fine.

is there any reason to keep the v0.6.4 as the minimun required version? can you change it to 0.4.7?

thanks
.jpg

Enable Wiki on Github?

Would it be alright if we enabled the Wiki so that the community can add content?

MSDN is a great place for official tutorials and blogs -- but I'm thinking that the community surrounding Windows Azure NodeJS could add their tutorials/demos/examples to this wiki...

Just a thought!

Cheers,
Jaime

README.md is not actually Markdown

The README.md file is HTML, not Markdown. We should do this right and 'convert' it to Markdown.

An important side benefit is that we will then be able to use GFM (GitHub Flavored Markdown)'s excellent source code syntax highlighting - today our Node JavaScript doesn't have this and we'll get it for free with backticking.

contents of local server.js.logs exposed after deploying to production

The server.js.logs folder and its contents is clearly visible inside the package (which is just some nested zip files).

On top of that iisnode.exe running in Azure exposes the folder without any regard to the setting in the Web.cloud.config.

Put these two together and you will leak a snapshot of your emulator log when publishing which includes console.log output. Development logs can reveal all sorts of secrets.

support projection on emulator (table storage)

Projection is not supported by table emulator and any attempt to use projection from SDK leads to an exception. Unfortunately, this prevents me from writing the code I want to write. I am left to use Array.map() to get what I want, but this isn't the code I would have liked to use. And adding branching all over the place isn't too appealing. Projection is obviously a better alternative. The situation is made more awkward by node SDK injecting some properties into entities beyond my control (id, etag, updated).

Why not emulate projection in the SDK code by stripping properties client-side as specified by select()? I think that would present developers with a more coherent toolset.

TableQuery _replaceOperators function can overwrite Partition Key results

I am writing a function that encodes a URL. The resulting partition key is:

aHR0cDovL2ZlZWRzLmZlZWRidXJuZXIuY29tL2ppbXdhbmdzYmxvZw==

However, when I use our TableQuery object to create a query containing this string like so:

var tableQuery = azure.TableQuery.select()
.from(feedDataTable)
.where('PartitionKey eq '' + base64.encode64(feedUrl) + ''');

The resulting query that gets pushed to the server is

PartitionKey eq 'aHR0cDovL2ZlZWRzLmZlZWRidXJuZXIuY29tL2ppbXdhbmdzYmxvZweq'

Which will return no results as the trailing == have been replaced by eq as per the _replaceOperators function in TableQuery. We should consider updating this to be a little smarter about when it does the replacement.

Table batch service should provide way to check if there are any operations pending

Currently we provide IsInBatch(), which returns whether or not you are in a batching context. However, if you try to call commit batch and haven't added any operations, we throw an exception.

The scenario I'm trying to implement is one where I am selectively updating my table entries (as I iterate through determining if any of them need updating - if they do, I add them to the batch). In the case that there are none that need updates, I will end up trying to commit an empty batch.

Table storage inserts with false boolean values fail

A table storage insert with a true boolean value, such as:

{ one: 'uno',
  two: { '@': { type: 'Edm.Double' }, '#': 2 },
  three: { '@': { type: 'Edm.Boolean' }, '#': true },
  four: 
   { '@': { type: 'Edm.DateTime' },
     '#': '2010-12-23T23:12:11.234Z' },
  PartitionKey: 'foo',
  RowKey: 'bar' }

works correctly. However, the same insert with a false value:

{ one: 'uno',
  two: { '@': { type: 'Edm.Double' }, '#': 2 },
  three: { '@': { type: 'Edm.Boolean' }, '#': false },
  four: 
   { '@': { type: 'Edm.DateTime' },
     '#': '2010-12-23T23:12:11.234Z' },
  PartitionKey: 'foo',
  RowKey: 'bar' }

generates an error ("One of the request inputs is not valid"). When I dump the XML of this failing request, it shows an extra set of <#> tags around the false value:

<m:properties>
  <d:one>uno</d:one>
  <d:two m:type="Edm.Double">2</d:two>
  <d:three m:type="Edm.Boolean"><#>false</#></d:three>
  <d:four m:type="Edm.DateTime">2010-12-23T23:12:11.234Z</d:four>
  <d:PartitionKey>foo</d:PartitionKey>
  <d:RowKey>bar</d:RowKey>
</m:properties>

A work around is to enclose the false value in quotes:

 { one: 'uno',
  two: { '@': { type: 'Edm.Double' }, '#': 2 },
  three: { '@': { type: 'Edm.Boolean' }, '#': 'false' },
  four: 
   { '@': { type: 'Edm.DateTime' },
     '#': '2010-12-23T23:12:11.234Z' },
  PartitionKey: 'foo',
  RowKey: 'bar' }

which causes the resulting XML to be generated correctly.

Provide API support for an OpenSSL like Cryptography library.

Almost all applications on the web require some level of cryptographic security even if just for hashing passwords and other sensitive data. There should be a uniform cross platform API for accessing the native and most appropriate (openssl or windows Cryptographic service) library to allow developers to leverage the same code regardless of deployment target. For example, I use the node-BCrypt library (https://github.com/ncb000gt/node.bcrypt.js) for hashing passwords, it obviously doesn't compile on the azure platform because openssl libraries aren't present. I am not even sure if the WCS provides for BCrypt, and if it doesn't it would definitely be something to get plumbed in for a variety of reasons, not the least of which is the reduced acceptance of SHA/MD5 hashes as "secure enough". In terms of API, Nick Campbell (ncb000gt) has a pretty good start at the JS level one that fits my needs and is abstract enough that it should work for any implementation of BCrypt library, I would start there and modify as appropriate and needed.

characters lost from value when doing table storage roundtrip

When round-tripping certain values to table storage and back the value is mangled. In some cases new line characters appear to be stripped on the way back. When querying the row from .NET I can see the original line breaks. So it appears there is no corruption, but rather just mangling somewhere in the node sdk. It doesn't happen for all values.

This popped up when storing a JavaScript function body in an azure table. Somehow this value (and any other similar snippet) is affected.

IN:

for ( var i in [1,2,3] ) { 
 console.log( i );
}

OUT:

for ( var i in [1,2,3] ) { console.log( i );
}

wherekeys() expects both partitionKey and rowKey to be not null

Current implementation basically emulates the GetEntity functionality. It would be highly beneficial to allow whereKeys to be passed with a partitionKey and a null rowKey, so that queries can be further optimized to return all records in a partition.

Running tests seems to fail with "queryTables" being undefined

When running the tests, I get this error:

Actual Results

✖ testInsertOrMerge

TypeError: Cannot call method 'queryTables' of undefined
    at Object.<anonymous> (C:\Projects\Github\azure-sdk-for-node\test\services\t
able\tableservice-tests.js:57:18)
    at C:\Projects\Github\azure-sdk-for-node\node_modules\nodeunit\lib\core.js:2
57:35
    at C:\Projects\Github\azure-sdk-for-node\node_modules\nodeunit\deps\async.js
:453:21
    at C:\Projects\Github\azure-sdk-for-node\node_modules\nodeunit\deps\async.js
:158:13
    at C:\Projects\Github\azure-sdk-for-node\node_modules\nodeunit\deps\async.js
:118:13
    at C:\Projects\Github\azure-sdk-for-node\node_modules\nodeunit\deps\async.js
:134:9
    at C:\Projects\Github\azure-sdk-for-node\node_modules\nodeunit\deps\async.js
:157:9
    at Object.mapSeries (C:\Projects\Github\azure-sdk-for-node\node_modules\node
unit\deps\async.js:147:23)
    at Object.series (C:\Projects\Github\azure-sdk-for-node\node_modules\nodeuni
t\deps\async.js:451:19)
    at Object.<anonymous> (C:\Projects\Github\azure-sdk-for-node\node_modules\no
deunit\lib\core.js:261:22)

✔ testNotEmulatedExplicitCredentials
✔ testEmulatedExplicitCredentials
✔ testEmulatedWithoutParameters
✔ testNotEmulatedWithoutParameters

FAILURES: 83/149 assertions failed (456ms)

I'm currently using the latest on master.

Expected Result

  • tests should pass...
  • queryTables should be a method that exists in the tableService object

Steps to reproduce

  • git clone git://github.com/WindowsAzure/azure-sdk-for-node.git
  • cd azure-sdk-for-node
  • npm install .
  • node .\test\runtests.js

Make TableService constructor usePathStyleURI setting smart about credentials

When a user specifies cerdentials in the TableService constructor, but does not specify whether or not path style URIs should be used, the constructor should make the choice based on the credential provided, not based on the EMULATED variable.

Should still use the EMULATED variable when no credentials are provided

issue on linux

npm install azure

doesn't work on ubuntu

jdavis@LittleDog:~/web$ node tablestore.js

node.js:201
       throw e; // process.nextTick error, or 'error' event on first tick
             ^
Error: Cannot find module './services/table/tableservice'
   at Function._resolveFilename (module.js:334:11)
   at Function._load (module.js:279:25)
   at Module.require (module.js:357:17)
   at require (module.js:368:17)
   at Object. (/home/jdavis/node_modules/azure/lib/azure.js:22:20)
   at Module._compile (module.js:432:26)
   at Object..js (module.js:450:10)
   at Module.load (module.js:351:31)
   at Function._load (module.js:310:12)
   at Module.require (module.js:357:17)
jdavis@LittleDog:~/web$

Explicit credentials cause auth error in QueueService

When I create a QueueService with explicit credentials and try to invoke listQueues:

var azure = require('azure');

var queueService = azure.createQueueService(testCredentials.account,testCredentials.key);

queueService.listQueues(function(err,queues) {
  if (err) {
    console.dir(err);
  } else {
    console.dir(queues);
  }
});

I get an authentication error with the following information:

Server used following string to sign: \'GET x-ms-date:Sun, 22 Jan 2012 19:38:21 GMT\nx-ms-version:2011-08-18\n/account/\ncomp:list\'.'

And this is the request being sent to Azure:

{ method: 'GET',
  path: 'http://account.queue.core.windows.net:80/?comp=list',
  host: 'account.queue.core.windows.net',
  port: 80,
  headers: 
   { 'Content-Type': '',
     'x-ms-version': '2011-08-18',
     'x-ms-date': 'Sun, 22 Jan 2012 19:38:21 GMT',
     Accept: 'application/atom+xml,application/xml',
     'Accept-Charset': 'UTF-8',
     Host: 'account.queue.core.windows.net:80',
     Authorization: 'SharedKey account:...=' 
   }
}

(where account is the name of my Azure storage account)

ISO8061Date format drops milliseconds

Currently, if you call

azure.ISO8061Date.format(new Date());

We will return something like this:

2011-12-17T21:31:46.0000773Z

If you then try to convert this back into a date, the milliseconds will be set to zero. The format that works is the following:

2011-12-17T21:31:46.773Z

simple program using storage crashes when deployed to cloud

The following program doesn't work when deployed to staging or production. node.exe appears to crash due to unhandled exception leaving only this behind in server.js.logs:

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: getaddrinfo ENOENT
    at errnoException (dns.js:31:11)
    at Object.onanswer [as oncomplete] (dns.js:140:16)

server.js

var http = require('http');
var port = process.env.port || 1337;

var KEY1 = "xxx";
var KEY2 = "zzz";

var util = require('util');
var azure = require('azure');
var tables = azure.createTableService(KEY1, KEY2);

http.createServer(function (req, res) {
    tables.createTableIfNotExists("Table", function (error) {
        res.writeHead(200, { 'Content-Type': 'text/plain' });
        if (error) {
            res.end('ERROR: ' + util.inspect(error,true));
        } else {
            res.end('EXISTS!');
        }
    });
}).listen(port);

Web.cloud.config (default, except enabled logging)

<?xml version="1.0" encoding="utf-8"?>
<configuration>
  <system.webServer>
    <modules runAllManagedModulesForAllRequests="false" />

    <!-- NOTE: By default, debugging and logging are unsecure and should not be enabled for production applications in the cloud.-->
    <iisnode 
      debuggingEnabled="false"
      loggingEnabled="true"
      devErrorsEnabled="false"
    />

    <!-- indicates that the server.js file is a node.js application 
    to be handled by the iisnode module -->
    <handlers>
      <add name="iisnode" path="server.js" verb="*" modules="iisnode" />
    </handlers>
    <rewrite>
      <rules>
        <clear />
        <rule name="app" enabled="true" patternSyntax="ECMAScript" stopProcessing="true">
            <match url="server\.js.+" negate="true" />
            <conditions logicalGrouping="MatchAll" trackAllCaptures="false" />
            <action type="Rewrite" url="server.js" />
        </rule>
      </rules>
    </rewrite>
  </system.webServer>
</configuration>

SQL Server Driver

Is there are recommended SQL Server Driver for SQL Azure? See a few out there, none of them look maintained.

Table batch service should provide way to check if there are any operations pending

Currently we provide IsInBatch(), which returns whether or not you are in a batching context. However, if you try to call commit batch and haven't added any operations, we throw an exception.

The scenario I'm trying to implement is one where I am selectively updating my table entries (as I iterate through determining if any of them need updating - if they do, I add them to the batch). In the case that there are none that need updates, I will end up trying to commit an empty batch.

socket hang up error when running in a tight loop

Dev estimate: 0
Test Estimate: 3

The repro code runs a call to getMessages from a queue service in a tight loop. Eventually you will get to an error where the socket has hung up which looks like this:

events.js:48
throw arguments[1]; // Unhandled 'error' event
^
Error: socket hang up
at createHangUpError (http.js:1104:15)
at Socket.onend (http.js:1167:27)
at TCP.onread (net.js:369:26)

At which point your role needs to recover from the crash. Is this some kind of throttling from Azure? Can we possibly handle this better?

Repro code:

var azure = require('azure')

var quickQueueService = azure.createQueueService();

//MAIN CODE FLOW
var eventLoop = function () {
quickQueueService.getMessages('foo', function(err, message) {
if(!err) {
console.log(new Date() + ' Success');
} else {
console.log(new Date() + 'Failure');
}
});
}
try {
setInterval(eventLoop, 5);
} catch (e) {
console.log('Error');
}

Enable proxying a request from azure blob storage to an incoming request

Today when using ServiceClient.performRequestInputStream (from cloudblobclient) it is impossible to relay the actual response headers into an incoming request stream.

To circumvent this we added the following line in beginning of the http.request callback :
writeStream.emit('start', response);

This allows us to copy the response headers into the incoming request response stream. Otherwise we are not able to relay the headers and status code.

It would be nice if you would support this directly with a dedicated method of the form:
ServiceClient.proxyRequest(requestParameters, rawData, incomingResponse, callback)
or by adding a dedicated prewrite event as the once we have added which allows the users to add this functionality themselves.

TableService.insertOrReplaceEntity doesn't work

I'm using TableStorage for storing server access logs in my Azure CoffeeScript tutorial. I also have a worker process that calculates access counts per URL.

To make this idempotent, I'm using a modified URL as the RowKey, and tried to use insertOrReplaceEntity. That always failed so I had to rewrite my code as:

countRequests url, (total) ->
  key = "url-#{url.replace('/', '-')}"
  totalEntry =
    total: total
    RowKey: key
    PartitionKey: 'totals1'
  table.insertEntity 'requestTotal', totalEntry, (error) ->
    return unless error
    table.updateEntity 'requestTotal', totalEntry, (error) ->
      console.log "Failed to update request count for #{url} to #{total}", error if error

Replace throwing errors by error callback parameter

For example in blobservice.js, there are 15 lines where errors are thrown. It's code that is being called with a nice callback structure and thus should the callback been invoked with the err as it's first parameter. For example in doing fs.stat in the same file this happens. So at the moment the module is mixing up errors and callbacks with errors as parameter. That's very unusable and can bring down a consuming service if not expected.

Querying Azure table in 0.5.2 returns truncated RowKeys

When you query an Azure table in version 0.5.2, the returned RowKeys are sometimes truncated. This isn't noticeable if the RowKeys are short, but it's a problem if one uses a GUID. I tested this against the storage emulator.

It's possible that other properties are truncated, but I've only noticed it with RowKeys.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.