# No response object with http in / http out

**URL:** https://discourse.nodered.org/t/no-response-object-with-http-in-http-out/3173
**Category:** General
**Created:** [15 September 2018 20:30 UTC](https://discourse.nodered.org/t/no-response-object-with-http-in-http-out/3173 "2018-09-15T20:30:33Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![johntalbott](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/johntalbott/32/5278_2.png) [@johntalbott](https://discourse.nodered.org/u/johntalbott)
#### Post date: [15 September 2018 20:30 UTC](https://discourse.nodered.org/t/no-response-object-with-http-in-http-out/3173/1 "2018-09-15T20:30:33Z")

</div>

I'm new to node-red and testing a function node to return data from sql server via sequelize and http input / http output nodes. Data is returned to the function.

My impression is that node.send is to be used for aync operations such as this, but I can't find a way around the "No response object" error.

Any suggestions?

_ **Function Code** _

```auto
var Sequelize = global.get('sequelize') //require('sequelize');
var sequelize = new Sequelize('my_db', 'username', 'password', {
  host: 'mydb.database.windows.net',
  dialect: 'mssql',
  pool: {
    max: 5,
    min: 0,
    idle: 10000
  },
  dialectOptions: {
    encrypt: true
  }
});

sequelize
  .authenticate()
  .then(() => {
      
        // var result = 'Connection has been established successfully.';
        // node.send({payload:result});
      
      sequelize.query("select top 10 * from DRAGDROPITEM", { type: sequelize.QueryTypes.SELECT}).then(rows => {
          
             node.send({payload:rows});

        })

  })
  .catch(err => {
      
    var result = 'Unable to connect to the database: ' + err;
    // node.send({payload:result});
    
  });

return;

```

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/4/4f7bc77269b400825ab45279a2f7bf3995a9f8f9.png)

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [15 September 2018 20:52 UTC](https://discourse.nodered.org/t/no-response-object-with-http-in-http-out/3173/2 "2018-09-15T20:52:00Z")

</div>

Hi @johntalbott

The `HTTP In` node sends its message with the `msg.res` property. This is the response object that _must_ reach the `HTTP Response` node so the request can be responded to.

With you're current code you are not passing on the property from your function. Where you have `node.send({payload:rows});` it would be better to do:

```auto
msg.payload = rows;
node.send(msg);

```

In other words, send on the message the Function received, but with its payload updated.

---

<div class="post-metadata">

### Author: ![johntalbott](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/johntalbott/32/5278_2.png) [@johntalbott](https://discourse.nodered.org/u/johntalbott)
#### Post date: [15 September 2018 21:29 UTC](https://discourse.nodered.org/t/no-response-object-with-http-in-http-out/3173/3 "2018-09-15T21:29:33Z")

</div>

That did it. The documentation threw me a bit. It makes sense now that you explained it.

A couple follow on questions ...

1. You referred to the approach you shared as "better" way. Is there a "best" way?

2. What is the use case for node.send example as explained in the documentation?

```auto
doSomeAsyncWork(msg, function(result) {
    node.send({payload:result});
});
return;

```

Thanks!

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [15 September 2018 21:32 UTC](https://discourse.nodered.org/t/no-response-object-with-http-in-http-out/3173/4 "2018-09-15T21:32:19Z")

</div>

For the specific task of sending the message, that approach is the 'right' way of doing it.

To be honest, we should update the docs to use the pattern of reusing the received message rather than creating a new message.

---

<div class="post-metadata">

### Author: ![johntalbott](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/johntalbott/32/5278_2.png) [@johntalbott](https://discourse.nodered.org/u/johntalbott)
#### Post date: [15 September 2018 21:38 UTC](https://discourse.nodered.org/t/no-response-object-with-http-in-http-out/3173/5 "2018-09-15T21:38:49Z")

</div>

Sounds good. I have to admit the current documentation had me staring at my computer screen for last day wondering what I was doing wrong.

Thanks again

---

<div class="post-metadata">

### Author: ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)
#### Post date: [16 September 2018 07:17 UTC](https://discourse.nodered.org/t/no-response-object-with-http-in-http-out/3173/6 "2018-09-16T07:17:19Z")

</div>

Nick,

Thanks for the reminder.  
I have now also added these guidelines in the [wiki](https://github.com/bartbutenaers/node-red-contrib-blockly/wiki/Send-message-to-an-output) of the Blockly node:

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/1/11fba40d7541a408e637b46177a0f3261a23d418.png)

@cymplecy: FYI

---

<div class="post-metadata">

### Author: ![Divyesh](https://avatars.discourse-cdn.com/v4/letter/d/ba8739/32.png) [@Divyesh](https://discourse.nodered.org/u/Divyesh)
#### Post date: [20 January 2020 14:32 UTC](https://discourse.nodered.org/t/no-response-object-with-http-in-http-out/3173/7 "2020-01-20T14:32:34Z")

</div>

Hello @knolleary,  
I'm using the same way as you mention. But seems like not getting the response.

When I tried to set **http response** at the same place of **debug:2** node. At that time I can get the response.  
But when I tried to set function between (bellow is the content of the function node). that time I can not get the response.

```auto
msg.payload = {'a':"divyesh"};
node.send(msg);

```

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/1/31cb92f7425f814d0f5a2c7f1d331b6748b83b14.jpeg)

Can you please help me in that case!
