question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Azure Functions: Node.js: Request ~2.34.0 not working

See original GitHub issue

Referring back to #226 and #223. The node module Request version 2.34.0 is not working on Azure Functions. Packages such as YQL are depending on it. Request version 2.70.0 is working correctly on Azure Functions. The below code snippet is working fine on request version 2.70.0, on version 2.34.0, however, the callback is never called.

var request = require('request');

module.exports = function (context) {  
    request('http://www.bing.com', function (error, response, body) {
        // This callback function will never be called on version 2.34.0
        if (error) {
            context.log(error);
        }

        if (!error && response.statusCode == 200) {
            context.log(body) // Show the HTML for the Bing homepage. 
        }
        context.done();
    });
};

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:20 (13 by maintainers)

github_iconTop GitHub Comments

2reactions
brettsamcommented, Jul 8, 2016

I’ve done some investigating here – the specific commit to request that fixes things is here: https://github.com/request/request/commit/27dfc1177e01025da6d3b09a0fd3406b90596719.

The issue looks to be around calling process.nextTick from Edge. Executing this code in Edge.Func() hangs as well:

return function(arg, callback) {
  process.nextTick(function() {
      console.log('done');
      callback();
  });
};

If you replace process.nextTick with setImmediate, things work. I see others reporting the same thing over at the Edge repo: https://github.com/tjanczuk/edge/issues/325. I’ll see if there’s a workaround or fix for this – otherwise, it appears that any package that uses process.nextTick will hang.

1reaction
brettsamcommented, Jul 12, 2016

PR #486 works around this issue. If you want to get things working before this change is deployed to production, you can add this to the your code before you make the call to request: process.nextTick = global.setImmediate;

Read more comments on GitHub >

github_iconTop Results From Across the Web

Azure Functions NodeJS: Https Request not working when ...
I am working with Azure Functions in NodeJS. I first wrote the function having azure funct locally on my laptop. The code worked...
Read more >
Azure function, Incompatible Node.js version (v18.15.0)
In vscode, starting a debug a Azure Function and error message, Incompatible Node.js version (v18.15.0). Refer to our documentation to see ...
Read more >
Release notes & updates – Azure CLI
Learn about the latest Azure Command-Line Interface (CLI) release notes and updates for both the current and beta versions of the CLI.
Read more >
Azure Functions Node.js developer guide
Understand how to develop functions by using Node.js. ... Not all options are supported when running locally. To learn more, see host.json.
Read more >
Upgrade to v4 of the Node.js model for Azure Functions
This article shows you how to upgrade your existing function apps running on v3 of the Node.js programming model to v4.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found