# Data clone error

**URL:** <https://forum.ionicframework.com/t/data-clone-error/98431>\
**Category:** ionic-v3\
**Created:** [July 17, 2017, 8:58am UTC](https://forum.ionicframework.com/t/data-clone-error/98431 "2017-07-17T08:58:18Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![fayiz](https://avatars.discourse-cdn.com/v4/letter/f/a698b9/32.png) [@fayiz](https://forum.ionicframework.com/u/fayiz)\
**Post date:** [July 17, 2017, 8:58am UTC](https://forum.ionicframework.com/t/data-clone-error/98431/1 "2017-07-17T08:58:18Z")

</div>

I am trying to store array of data in storage, but in i’m getting these errors, please get me some solution  
ERROR Error: Uncaught (in promise): DataCloneError: Failed to execute ‘put’ on ‘IDBObjectStore’: function (responseObserver) {  
var \_xhr = browserXHR.build();  
\_xhr.open(RequestMethod[re…… } could not be cloned.  
Error: Failed to execute ‘put’ on ‘IDBObjectStore’: function (responseObserver) {  
var \_xhr = browserXHR.build();

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [July 17, 2017, 1:58pm UTC](https://forum.ionicframework.com/t/data-clone-error/98431/2 "2017-07-17T13:58:23Z")

</div>

What is your `ionic info` output?  
Where and how are you testing?

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [July 17, 2017, 7:24pm UTC](https://forum.ionicframework.com/t/data-clone-error/98431/3 "2017-07-17T19:24:28Z")

</div>

Can you call `JSON.stringify()` on this array?

---

<div class="post-metadata">

**Author:** ![fayiz](https://avatars.discourse-cdn.com/v4/letter/f/a698b9/32.png) [@fayiz](https://forum.ionicframework.com/u/fayiz)\
**Post date:** [July 18, 2017, 8:13am UTC](https://forum.ionicframework.com/t/data-clone-error/98431/4 "2017-07-18T08:13:12Z")

</div>

I am testing in Chrome  
and these error i’m getting  
ERROR Error: Uncaught (in promise): DataCloneError: Failed to execute ‘put’ on ‘IDBObjectStore’: function (responseObserver) {  
var \_xhr = browserXHR.build();  
\_xhr.open(RequestMethod[re… } could not be cloned.  
Error: Failed to execute ‘put’ on ‘IDBObjectStore’: function (responseObserver) {  
var \_xhr = browserXHR.build();

---

<div class="post-metadata">

**Author:** ![fayiz](https://avatars.discourse-cdn.com/v4/letter/f/a698b9/32.png) [@fayiz](https://forum.ionicframework.com/u/fayiz)\
**Post date:** [July 18, 2017, 1:18pm UTC](https://forum.ionicframework.com/t/data-clone-error/98431/5 "2017-07-18T13:18:29Z")

</div>

core.es5.js:1084 ERROR Error: Uncaught (in promise): DataCloneError: Failed to execute ‘put’ on ‘IDBObjectStore’: function (responseObserver) {  
var \_xhr = browserXHR.build();  
\_xhr.open(RequestMethod[re…… } could not be cloned.  
Error: Failed to execute ‘put’ on ‘IDBObjectStore’: function (responseObserver) {  
var \_xhr = browserXHR.build();  
\_xhr.open(RequestMethod[re…… } could not be cloned.  
at localforage.js:944  
at t.invoke (polyfills.js:3)  
at Object.onInvoke (core.es5.js:4128)  
at t.invoke (polyfills.js:3)  
at r.run (polyfills.js:3)  
at polyfills.js:3  
at t.invokeTask (polyfills.js:3)  
at Object.onInvokeTask (core.es5.js:4119)  
at t.invokeTask (polyfills.js:3)  
at r.runTask (polyfills.js:3)  
at localforage.js:944  
at t.invoke (polyfills.js:3)  
at Object.onInvoke (core.es5.js:4128)  
at t.invoke (polyfills.js:3)  
at r.run (polyfills.js:3)  
at polyfills.js:3  
at t.invokeTask (polyfills.js:3)  
at Object.onInvokeTask (core.es5.js:4119)  
at t.invokeTask (polyfills.js:3)  
at r.runTask (polyfills.js:3)  
at c (polyfills.js:3)  
at polyfills.js:3  
at polyfills.js:3  
at t.invoke (polyfills.js:3)  
at Object.onInvoke (core.es5.js:4128)  
at t.invoke (polyfills.js:3)  
at r.run (polyfills.js:3)  
at polyfills.js:3  
at t.invokeTask (polyfills.js:3)  
at Object.onInvokeTask (core.es5.js:4119)

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [July 18, 2017, 2:34pm UTC](https://forum.ionicframework.com/t/data-clone-error/98431/6 "2017-07-18T14:34:17Z")

</div>

You have to run `ionic info` in the command line in your project directory.

---

<div class="post-metadata">

**Author:** ![fayiz](https://avatars.discourse-cdn.com/v4/letter/f/a698b9/32.png) [@fayiz](https://forum.ionicframework.com/u/fayiz)\
**Post date:** [July 19, 2017, 9:26am UTC](https://forum.ionicframework.com/t/data-clone-error/98431/7 "2017-07-19T09:26:22Z")

</div>

yea had done, its getting package information. what is the use of this ? how its help to debug data clone error

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [July 19, 2017, 9:40am UTC](https://forum.ionicframework.com/t/data-clone-error/98431/8 "2017-07-19T09:40:37Z")

</div>

It tells me your operating system, the versions of the packages you installed, etc.

But you don’t have to post it, I just won’t help you then. Good luck.

---

<div class="post-metadata">

**Author:** ![fayiz](https://avatars.discourse-cdn.com/v4/letter/f/a698b9/32.png) [@fayiz](https://forum.ionicframework.com/u/fayiz)\
**Post date:** [July 19, 2017, 10:23am UTC](https://forum.ionicframework.com/t/data-clone-error/98431/9 "2017-07-19T10:23:52Z")

</div>

Its Packages details bro, Please Help me  
global packages:

```
@ionic/cli-utils : 1.4.0
Cordova CLI : 7.0.1
Ionic CLI : 3.4.0

```

local packages:

```
@ionic/app-scripts : 1.3.7
@ionic/cli-plugin-cordova : 1.4.1
@ionic/cli-plugin-ionic-angular : 1.3.2
Cordova Platforms : android 6.2.3
Ionic Framework : ionic-angular 3.3.0

```

System:

```
Node : v7.10.0
OS : Windows 10
Xcode : not installed
ios-deploy : not installed
ios-sim : not installed
npm : 4.2.0
```

---

<div class="post-metadata">

**Author:** ![Sujan12](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/sujan12/32/108395_2.png) [@Sujan12](https://forum.ionicframework.com/u/Sujan12)\
**Post date:** [July 19, 2017, 10:39am UTC](https://forum.ionicframework.com/t/data-clone-error/98431/10 "2017-07-19T10:39:13Z")

</div>

> [@fayiz](#):
>
> @ionic/app-scripts : 1.3.7

Upgrade that to at least 1.3.12, better 2.x (but read the changelog).

> [@fayiz](#):
>
> Ionic CLI : 3.4.0

No reason to not update this to 3.5.

Rest looks fine.

After you made these updates, post your `ionic info` again and the code that is causing the error you posted. Right now I have no idea what you are actually doing.

---

<div class="post-metadata">

**Author:** ![fayiz](https://avatars.discourse-cdn.com/v4/letter/f/a698b9/32.png) [@fayiz](https://forum.ionicframework.com/u/fayiz)\
**Post date:** [July 22, 2017, 3:54pm UTC](https://forum.ionicframework.com/t/data-clone-error/98431/11 "2017-07-22T15:54:03Z")

</div>

I am trying to save Array of element to ionic storage, taking data in the format of JSON, the code is here,

import { Injectable } from ‘@angular/core’;  
import { Post } from ‘…/providers/wp-provider/wp-provider’;  
import { Storage } from ‘@ionic/storage’;

@Injectable()  
export class QuotesService {

private favoriteQuotes: Post[] = [];  
private readQuotes: Post[] = [];

constructor(public storage: Storage) { }

addQuoteToFavorites(quote: Post) {  
this.favoriteQuotes.push(quote);  
console.log(this.favoriteQuotes);

```
}

```

removeQuoteFromFavorites(quote: Post) {  
const position = this.favoriteQuotes.findIndex((quoteEl: Post) =\>{  
return [quoteEl.id](http://quoteEl.id) == [quote.id](http://quote.id);  
});  
this.favoriteQuotes.splice(position, 1);  
}

getFavoriteQuotes() {  
return this.favoriteQuotes.slice();  
}  
addQuoteToRead(quote: Post) {  
this.readQuotes.push(quote);  
console.log(this.readQuotes);  
}  
removeQuoteFromRead(quote: Post) {  
const position = this.readQuotes.findIndex((quoteEl: Post) =\>{  
return [quoteEl.id](http://quoteEl.id) == [quote.id](http://quote.id);  
});  
this.readQuotes.splice(position, 1);  
}

getReadQuotes() {  
return this.readQuotes.slice();  
}

openPost(post){

}

}

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [July 22, 2017, 4:25pm UTC](https://forum.ionicframework.com/t/data-clone-error/98431/12 "2017-07-22T16:25:51Z")

</div>

I’m not seeing where you’re doing anything with storage here.

---

<div class="post-metadata">

**Author:** ![fayiz](https://avatars.discourse-cdn.com/v4/letter/f/a698b9/32.png) [@fayiz](https://forum.ionicframework.com/u/fayiz)\
**Post date:** [July 22, 2017, 4:43pm UTC](https://forum.ionicframework.com/t/data-clone-error/98431/13 "2017-07-22T16:43:24Z")

</div>

When i am using ‘set’ storage, i am getting data clone error, thank you for your’r replay

import { Injectable } from ‘@angular/core’;  
import { Post } from ‘…/providers/wp-provider/wp-provider’;  
import { Storage } from ‘@ionic/storage’;

@Injectable()  
export class QuotesService {

private favoriteQuotes: Post[] = [];

constructor(public storage: Storage) { }

addQuoteToFavorites(quote: Post) {  
this.favoriteQuotes.push(quote);  
this.storage.set(‘fvrt’,this.favoriteQuotes);  
}

---

<div class="post-metadata">

**Author:** ![rapropos](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/rapropos/32/100227_2.png) [@rapropos](https://forum.ionicframework.com/u/rapropos)\
**Post date:** [July 22, 2017, 4:45pm UTC](https://forum.ionicframework.com/t/data-clone-error/98431/14 "2017-07-22T16:45:00Z")

</div>

Did you ever answer my earlier question?

> [@rapropos](#):
>
> Can you call JSON.stringify() on this array?
