# Fetch Problem and Fuse.Scripting.V8.Object Error

**URL:** <https://forums.fusetools.com/t/fetch-problem-and-fuse-scripting-v8-object-error/5089>\
**Category:** How-to Discussions\
**Created:** [January 14, 2017, 8:55pm UTC](https://forums.fusetools.com/t/fetch-problem-and-fuse-scripting-v8-object-error/5089 "2017-01-14T20:55:47Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![scotty2nd](https://avatars.discourse-cdn.com/v4/letter/s/35a633/32.png) [@scotty2nd](https://forums.fusetools.com/u/scotty2nd)\
**Post date:** [January 14, 2017, 8:55pm UTC](https://forums.fusetools.com/t/fetch-problem-and-fuse-scripting-v8-object-error/5089/1 "2017-01-14T20:55:47Z")

</div>

Hello,

in the following code i send a json with a firstname, lastname and phone number and get a 200 Status Code back.

Thats good but i came never to the part ‘Do something with the result’.

Instead i came in the part ‘An error occurred somewhere in the Promise chain’ and get a Fuse.Scripting.V8.Object Error in the Monitor.

I tested the same json with an RESTeasy extension for Chrome an here i get a response back ‘{“notice”: {“text”: “Customer Added”}’.

Can help me anyone?

Thanks and sorry for my bad english

```auto
var Observable = require("FuseJS/Observable");

var username = Observable("");
var password = Observable("");
var email = Observable("");
var data = Observable();

function click() {
    var requestObject = {first_name: username.value, last_name: email.value, phone: password.value};
	var status = 0;
	var response_ok = false;

	fetch('http://slimapp.dev/api/customer/add', {
	  	method: 'POST',
	  	headers: { "Content-type": "application/json", "Accept": "application/json" },
	  	body: JSON.stringify(requestObject)
  	}).then(function(response) {
    	status = response.status; // Get the HTTP status code
		response_ok = response.ok; // Is response.status in the 200-range?
	  	console.log("Status Code " + status);
	  	return response.json(); // This returns a promise
  	}).then(function(responseObject) {
	    // Do something with the result
	    console.log('do something');
	    data.value = responseObject;
	}).catch(function(error) {
	    // An error occurred somewhere in the Promise chain
	    console.log('error ' . error);
	    debugger;
	});
}

module.exports = {
	username: username,
	email: email,
	password: password,
	click: click,
	data: data,
};

```

---

<div class="post-metadata">

**Author:** ![Anders\_Bondehagen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/anders_bondehagen/32/98_2.png) [@Anders\_Bondehagen](https://forums.fusetools.com/u/Anders_Bondehagen)\
**Post date:** [January 16, 2017, 11:09am UTC](https://forums.fusetools.com/t/fetch-problem-and-fuse-scripting-v8-object-error/5089/2 "2017-01-16T11:09:20Z")

</div>

Try to parse the response as `.text()` instead and look at the result. Could be that the server returns invalid JSON.

---

<div class="post-metadata">

**Author:** ![snehadeep.bhowmick](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@snehadeep.bhowmick](https://forums.fusetools.com/u/snehadeep.bhowmick)\
**Post date:** [May 15, 2017, 6:44pm UTC](https://forums.fusetools.com/t/fetch-problem-and-fuse-scripting-v8-object-error/5089/3 "2017-05-15T18:44:04Z")

</div>

Hi,

I’m getting the same issue:

```auto
  <JavaScript>
    var Observable = require("FuseJS/Observable");
    var json = Observable();
function foo(){
 fetch('https://jsonplaceholder.typicode.com/posts/1')
.then(function(response) {
  if (!response.ok) {
    throw Error(response.statusText);
  }
  return response.json();
})
.then(function(responseAsJson) {

   json = JSON.stringify(responseAsJson);
   console.log(json);
})
.catch(function(error) {
  console.log('Looks like there was a problem:', error);
  console.log('---------------------------------------');
});
};

    module.exports = {
    foo: foo,
    }
  </JavaScript>
<Button Clicked="{foo}" Text="click"/>

```

and here is the log:

```auto
[Viewport]: Looks like there was a problem:
[Viewport]: Fuse.Scripting.V8.Object
[Viewport]: ---------------------------------------

```

Although i have tested in chrome, it works perfect:

 ![file](https://s3.us-east-2.amazonaws.com/fuse-legacy-forum-assets/hrEMQWFhOT9O-image-1494873795527.jpeg)

---

<div class="post-metadata">

**Author:** ![snehadeep.bhowmick](https://avatars.discourse-cdn.com/v4/letter/s/5daacb/32.png) [@snehadeep.bhowmick](https://forums.fusetools.com/u/snehadeep.bhowmick)\
**Post date:** [May 15, 2017, 7:39pm UTC](https://forums.fusetools.com/t/fetch-problem-and-fuse-scripting-v8-object-error/5089/4 "2017-05-15T19:39:18Z")

</div>

Sorry, never mind. I got the problem, the PromiseStatus is pending.

---

<div class="post-metadata">

**Author:** ![Anders\_Bondehagen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/anders_bondehagen/32/98_2.png) [@Anders\_Bondehagen](https://forums.fusetools.com/u/Anders_Bondehagen)\
**Post date:** [May 17, 2017, 5:47pm UTC](https://forums.fusetools.com/t/fetch-problem-and-fuse-scripting-v8-object-error/5089/5 "2017-05-17T17:47:00Z")

</div>

We do not support the second argument to log that you are using. Could you try:

```auto
.catch(function(error) {
  console.log('Looks like there was a problem: ' + JSON.stringify(error));
  console.log('---------------------------------------');
});
};

```
