Skip to content

Exception in template helper: idStringify after update to newest core package versions #32

@jankapunkt

Description

@jankapunkt

I updated my meteor packages as shown below:

Changes to your project's package version selections from updating package versions:
                                              
accounts-base          upgraded from 1.3.1 to 1.3.2
babel-compiler         upgraded from 6.19.4 to 6.20.0
boilerplate-generator  upgraded from 1.1.1 to 1.2.0
ddp-client             upgraded from 2.0.0 to 2.1.0
ejson                  upgraded from 1.0.13 to 1.0.14
minifier-js            upgraded from 2.1.1 to 2.1.2
minimongo              upgraded from 1.2.1 to 1.3.0
modules                upgraded from 0.9.4 to 0.10.0
mongo                  upgraded from 1.1.22 to 1.2.0
mongo-dev-server       added, version 1.0.1
promise                upgraded from 0.8.9 to 0.9.0
webapp                 upgraded from 1.3.17 to 1.3.18

After restarting my application, I get the following error on the upload template:

Exception in template helper: idStringify@http://localhost:3000/packages/mongo-id.js?hash=345d169d517353f8146292b4abd24061721f8b26:104:20
get@http://localhost:3000/packages/id-map.js?hash=c7aea8dfa2bf46ff2ae0aa6c6cf09e36abc61d07:46:32
_getRawObjects@http://localhost:3000/packages/minimongo.js?hash=8cd7b53507123da052698c62ae61243696868347:1870:52
observeChanges@http://localhost:3000/packages/minimongo.js?hash=8cd7b53507123da052698c62ae61243696868347:1704:42
_depend@http://localhost:3000/packages/minimongo.js?hash=8cd7b53507123da052698c62ae61243696868347:1822:28
forEach@http://localhost:3000/packages/minimongo.js?hash=8cd7b53507123da052698c62ae61243696868347:1563:21
fetch@http://localhost:3000/packages/minimongo.js?hash=8cd7b53507123da052698c62ae61243696868347:1532:19
findOne@http://localhost:3000/packages/minimongo.js?hash=8cd7b53507123da052698c62ae61243696868347:2107:48
findOne@http://localhost:3000/packages/mongo.js?hash=191d09671a8d33340d4acaaa8c6015f73cc58072:404:36
findOne@http://localhost:3000/packages/ostrio_files.js?hash=da1f9645c3941d417a179125f36523e923269097:1301:34
uploadedFile@http://localhost:3000/packages/ostrio_autoform-files.js?hash=1f12457e52feebf281eef44e50074319fdd0740f:264:30

Which traces to the following code in the mondo-ids core package:

MongoID.idStringify = function (id) {                                                                 // 56
  if (id instanceof MongoID.ObjectID) {                                                               // 57
    return id.valueOf();                                                                              // 58
  } else if (typeof id === 'string') {                                                                // 59
    if (id === "") {                                                                                  // 60
      return id;                                                                                      // 61
    } else if (id.substr(0, 1) === "-" || // escape previously dashed strings                         // 62
               id.substr(0, 1) === "~" || // escape escaped numbers, true, false                      // 63
               MongoID._looksLikeObjectID(id) || // escape object-id-form strings                     // 64
               id.substr(0, 1) === '{') { // escape object-form strings, for maybe implementing later
      return "-" + id;                                                                                // 66
    } else {                                                                                          // 67
      return id; // other strings go through unchanged.                                               // 68
    }                                                                                                 // 69
  } else if (id === undefined) {                                                                      // 70
    return '-';                                                                                       // 71
  } else if (typeof id === 'object' && id !== null) {                                                 // 72
    throw new Error("Meteor does not currently support objects other than ObjectID as ids");          // 73
  } else { // Numbers, true, false, null                                                              // 74
    return "~" + JSON.stringify(id);                                                                  // 75
  }                                                                                                   // 76
};    

The error is thrown on line 72, ("Meteor does not currently support objects other than ObjectID as ids").

Reproduction of the error

I created for reproduction a new clean project with latest meteor version and core packages versions and added the following packages:

ostrio:[email protected]
ostrio:[email protected]
aldeed:collection2-core
dburles:[email protected]

plus

    "gridfs-stream": "^1.1.1",
    "simpl-schema": "^0.3.2"

Then I created the Images with GridFs integration, like from the wiki: https://github.com/VeliovGroup/Meteor-Files/wiki/GridFS-Integration

Then I created the Schema and the template, like in the README of this package, using a quickForm with type insert.

The error shows up.

My assumption is, that there is now a more sensitive id handling implemented in minimongo and I am not sure, whether there needs to be a change in this package or ostrio:files or if it is an error in the new minimongo version.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions