Meteor: No plugin found named “ensureSignedIn”

Problem:

If you are using iron:router, after updating Meteor to version 1.1.0.3 you may start to encounter below errors in case you are using protective pages with ‘ensureSignedIn’

W20150812-18:40:06.912(5.5)? (STDERR) You now need a routing package like useraccounts:iron-routing or useraccounts:flow-routing to be able to configure routes!

W20150812-18:40:06.943(5.5)? (STDERR)
W20150812-18:40:06.943(5.5)? (STDERR) \.meteor\packages\meteor-tool\1.1.4\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules\fibers\future.js:245
W20150812-18:40:06.943(5.5)? (STDERR)
throw(ex);
W20150812-18:40:06.943(5.5)? (STDERR)
      ^
W20150812-18:40:06.943(5.5)? (STDERR) Error: No plugin found named "ensureSignedIn"
W20150812-18:40:06.943(5.5)? (STDERR)     at Function.Router.plugin (packages/iron:router/lib/router.js:394:1)
W20150812-18:40:06.943(5.5)? (STDERR)     at lib\_config/router.coffee:33:8
W20150812-18:40:06.943(5.5)? (STDERR)     at lib\_config/router.coffee:1:1
W20150812-18:40:06.943(5.5)? (STDERR)     at \.meteor\local\build\programs\server\boot.js:222:10
W20150812-18:40:06.943(5.5)? (STDERR)     at Array.forEach (native)
W20150812-18:40:06.943(5.5)? (STDERR)     at Function._.each._.forEach (\.meteor\packages\meteor-tool\1.1.4\mt-os.windows.x86_32\dev_bundle\server-lib\node_modules\underscore\underscore.js:79:11)
W20150812-18:40:06.943(5.5)? (STDERR)     at \.meteor\local\build\programs\server\boot.js:117:5
=> Exited with code: 8
=> Your application is crashing. Waiting for file change.

Solution:

There is an issue here that suggests a workaround of wrapping your Router.plugin(‘ensureSignedIn’,…) code as below inside an if(Meteor.isClient) statement.

if (Meteor.isClient) {
  Router.plugin('ensureSignedIn', {
      except: [ 'singIn', 'signUp' ]
  });
}

However, it may or may not solve your problem. In case it does not solve your problem, try the below solution.

There are new packages on atmosphere with the names of useraccounts:iron-routing and useraccounts:flow-routing that seems to be required now in the latest version to use the ‘ensureSignedIn’ feature. Based on the router you are using, add one of these packages to your app and it should solve your problem.

meteor add useraccounts:iron-routing

or

meteor add useraccounts:flow-routing

Comments