-
Notifications
You must be signed in to change notification settings - Fork 413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Static numbered routes makes Meteor fail to start #986
Comments
Interesting. Not sure how this would happen. Can you debug a little in chrome and let us know what you find? that error check I think just checks for the existence of a property in an object (e.g. the path). So not clear to me from the example above why it might be duplicating. |
Hi @cmather, I've updated the reproduction scenario (forget to show that I only added one package). Here is the list of package involved: autopublish 1.0.1 Publish the entire database to all clients
insecure 1.0.1 Allow all database writes by default
iron:router 1.0.0 Routing specifically designed for Meteor
meteor-platform 1.2.0 Include a standard set of Meteor packages in your app Pretty basic. There shouldn't be anything that mess with the routes. I've checked Chrome dev tools's console. It displays nothing. In the Chrome browser, Meteor displays the same error as the CLI. Even, if I remove |
Well first thing to check is: does this issue happen with a new project. It might be a weird issue with how javascript deals with object property names (which is how we're determining if a route already exists). The code that's checking whether the handler already exists by name is in iron:middleware-stack here: https://github.com/EventedMind/iron-middleware-stack/blob/master/lib/middleware_stack.js#L29. I'll try to take a closer look sometime soon too. Just giving you some extra tools to dig into it in case I run out of time to get to it before leaving for a trip today. @tmeasday, do you see anything here that would cause the handler name to be duplicated based on the scheme illustrated in the first comment above? |
Humm.. Trying to debug it currently, but I'm a bit lost. |
Actually, in this Sorry guys, I can't go any further. It's too late in France for carrying on. I hope that I've lead you on the right track. |
Can confirmed that simply creating a project with
Causes the problem. It's not obvious to me digging through the source why it would happen. |
I'm on my way to France but will take a look when I get back to SF :-) I suspect this has something to do with either: (a) javascript object properties (tom try creating a regular object with these property keys and see if it does anything weird) or (b) some conversion being applied before I add to the middleware stack by name.
|
I just updated my app to latest version of meteor (1.0) from 0.8.1 and I am facing the same issue. |
As I suspected the problem is that the middleware stack uses an array as both an object and a array: https://github.com/EventedMind/iron-middleware-stack/blob/master/lib/middleware_stack.js#L33 I always thought this was asking for trouble :) Try this:
You'll see the problem :) JS helpfully casts @cmather I think the answer is: don't do that. @pem and @inderpreetsingh the work around is don't use route names that are numbers. |
If it's not an array we can't support anonymous wildcard params. Maybe that's an okay trade off.
|
I think you are thinking of something else (doing the same wacky thing for In either case there's definitely another way to do it! |
Oh oops. Well we could have a separate object that serves as a name index if we want.
|
Totally :) |
I tried to get this done quickly but ran into some problems. So I think I'll try to get a release out today and come back to this one. |
Thanks for the workaround. That's exactly what I did. String expansion is not a big deal after all 😉 And thank you twice for your package and you dedication to it. I'm just impressed by your work, guys 👏 (a french fan). |
Here the pattern of reproduction:
meteor create route11 cd route11 meteor add iron:router
Edit route11.js with the following content:
Meteor fails to start and provides the following stack:
The text was updated successfully, but these errors were encountered: