Reaction: npm simple-schema errors in production v1.10

Created on 12 Apr 2018  路  5Comments  路  Source: reactioncommerce/reaction

Issue Description

The following errors were encountered when running in production:
Error: "settings.cart.cleanupDurationDays" is in the schema but "settings.cart" is not
Error: "settings.public.segmentio.enabled" is in the schema but "settings.public.segmentio" is not
Other similar errors show once these are fixed.

Steps to Reproduce

Not sure how to reproduce locally. I was running a custom production image which was dockerized. However, the issue and cause are clear. These lines of code are only accessed in production, and so weren't found during the transition to npm simple-scheme.

Possible Solution

Add

  "settings.cart": {
    type: Object,
    optional: true,
    defaultValue: {}
  }

or similar to the relevant schemes.

Note

I'm finding and fixes all instances and will create a pull request upon completion.

Versions

Node: 8.9.0
NPM: 5.7.1
Meteor Node: 8.9.4
Meteor NPM: 5.6.0
Reaction CLI: 0.29.0
Reaction: 1.10.0
Reaction branch: shipping-by-weight
Docker: 18.03.0-ce

bug

Most helpful comment

This is due to npm installing and getting 1.4.3 of simpl-schema package, which made these silent errors louder. The quick fix is to pin "simpl-schema": "1.4.2" in package.json and then reinstall.

These are actual schema errors, though so someone should also do a PR to bump to 1.4.3 (pinned) and fix all of the schemas

All 5 comments

@willmoss1000 When you make a PR you could probably just remove that analytics.js as I believe it's not used any longer.

Having this issue as well. After fixing the missing schema fields causing Reaction not to start up, all I'm getting on the client side is a blank page and the following error in the console: Uncaught Error: "settings.shops.enabledShopTypes" is in the schema but "settings.shops" is not.

This is due to npm installing and getting 1.4.3 of simpl-schema package, which made these silent errors louder. The quick fix is to pin "simpl-schema": "1.4.2" in package.json and then reinstall.

These are actual schema errors, though so someone should also do a PR to bump to 1.4.3 (pinned) and fix all of the schemas

Errors keeps on popping even after updating registry.js and analytics.js. Simplest solution is to restrict the simpl-schema to 1.4.2 in package.json

Ok, I'm pinning to 1.4.2 for now. Sorry, I don't have time to find all these right now as we are launching Monday. The errors I've found so far are:
registry.js:

  "settings.cart": {
    type: Object,
    optional: true,
    defaultValue: {}
  }

analytics.js:

  "settings.public.segmentio": {
    type: Object,
    optional: true,
    defaultValue: {}
  },
  "settings.public.googleAnalytics": {
    type: Object,
    optional: true,
    defaultValue: {}
  },
  "settings.public.mixpanel": {
    type: Object,
    optional: true,
    defaultValue: {}
  },
  "settings.public": {
    type: Object,
    optional: true,
    defaultValue: {}
  }

marketplace.js:

  "settings.shops": {
    type: Object,
    optional: true,
    defaultValue: {}
  },

This could well be all of them, but likely isn't. If I do find the time this evening I'll post here, and submit a pull requests if they are all found.

Note: as @zenweasel suggested above. Remove Analytics.js when the request is submitted.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aaronjudd picture aaronjudd  路  3Comments

nnnnat picture nnnnat  路  4Comments

zikeji picture zikeji  路  4Comments

spencern picture spencern  路  3Comments

ajporlante picture ajporlante  路  4Comments