Skip to content
This repository has been archived by the owner on Jun 12, 2018. It is now read-only.

Client exception: a.forEach is not a function #803

Open
clochix opened this issue Mar 25, 2016 · 3 comments
Open

Client exception: a.forEach is not a function #803

clochix opened this issue Mar 25, 2016 · 3 comments
Labels

Comments

@clochix
Copy link
Contributor

clochix commented Mar 25, 2016

A user reports than when he tries to open the Email application, he only get a white page.
Here's the error found inside its logs:

EROR +03583 controllers:activity { type: 'error',
  error:
   { msg: 'a.forEach is not a function',
     name: 'TypeError',
     full: 'TypeError: a.forEach is not a function',
     stack: 'TypeError: a.forEach is not a function\n    at https://antoine-2.cozycloud.cc/apps/emails/js/app.js:15:10228\n    at Array.forEach (native)\n    at t (https://antoine-2.cozycloud.cc/apps/emails/js/app.js:15:10160)\n    at Qe.de.withMutations (https://antoine-2.cozycloud.cc/apps/emails/js/vendor.js:10:7827)\n    at n (https://antoine-2.cozycloud.cc/apps/emails/js/app.js:15:10523)\n    at https://antoine-2.cozycloud.cc/apps/emails/js/app.js:15:10570\n    at https://antoine-2.cozycloud.cc/apps/emails/js/app.js:15:11336\n    at d (https://antoine-2.cozycloud.cc/apps/emails/js/vendor.js:1:807)\n    at h (https://antoine-2.cozycloud.cc/apps/emails/js/vendor.js:1:952)\n    at https://antoine-2.cozycloud.cc/apps/emails/js/vendor.js:1:738' },
  href: 'https://antoine-2.cozycloud.cc/apps/emails/' }
EROR +0001 controllers:activity TypeError: a.forEach is not a function
    at https://antoine-2.cozycloud.cc/apps/emails/js/app.js:15:10228
    at Array.forEach (native)
    at t (https://antoine-2.cozycloud.cc/apps/emails/js/app.js:15:10160)
    at Qe.de.withMutations (https://antoine-2.cozycloud.cc/apps/emails/js/vendor.js:10:7827)
    at n (https://antoine-2.cozycloud.cc/apps/emails/js/app.js:15:10523)
    at https://antoine-2.cozycloud.cc/apps/emails/js/app.js:15:10570
    at https://antoine-2.cozycloud.cc/apps/emails/js/app.js:15:11336
    at d (https://antoine-2.cozycloud.cc/apps/emails/js/vendor.js:1:807)
    at h (https://antoine-2.cozycloud.cc/apps/emails/js/vendor.js:1:952)
    at https://antoine-2.cozycloud.cc/apps/emails/js/vendor.js:1:738

Good luck!

@clochix clochix added the bug label Mar 25, 2016
@clochix
Copy link
Contributor Author

clochix commented Mar 25, 2016

This errors seems to happen when importing contacts. datapoints of some contacts is an object instead of an array, so we can't use forEach to iterate on it.

@clochix
Copy link
Contributor Author

clochix commented Mar 25, 2016

This affects 6 out the 18.268 contacts of this user. Here's one of them (anonymized):

{
   "n" : "Xxxxxx;Yyyyyy;;;",
   "datapoints" : {
      "0" : {
         "value" : "+33 1 00 00 00 00",
         "name" : "tel",
         "type" : "cell"
      }
   },
   "carddavuri" : "9ccf7dc5-b0f2-418c-adca-cde0b5c2a8cd.vcf",
   "_id" : "7acb5f78170d3d69e5cc406575b9bb51",
   "docType" : "contact",
   "_rev" : "1-9fc32691e80b7bf337d0f1f8eee4858e",
   "fn" : "Yyyyyy Xxxxxx"
}

@m4dz
Copy link
Contributor

m4dz commented Mar 25, 2016

I think we should patch the contacts directly in the Contacts app to ensure the data typing.

@poupotte, @frankrousseau : It re-opens the conversation about sharing data between-apps: emails should probably not be allowed to get contacts itself from the DS but rather rely on a service in the DS which exposes contacts and ensure permissions (and eventually ensure data types like in this case), right?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants