So I’m at a loss as to what to do next. I’m using Meteor 1.3 beta 11, attempting to refactor an app to modules and Mantra.
In client/modules/authentication/index.js I had the following code:
const authState = {
passwordResetToken: null,
emailVerifyToken: null,
authDoneCallback: null
}
export {authState}
And I used this to store tokens for password reset/email verification. There was a point where client/modules/core/components/home.jsx imported authState and used it to determine whether to show my main homepage or the password reset component. I’ve since eliminated that dependency, moved that check into client/modules/authentication/router.jsx and have generally made things nicer. I then removed authState from client/modules/authentication/index.js and instead placed the following in client/modules/authentication/state.js:
export default {
passwordResetToken: null,
emailVerifyToken: null,
authDoneCallback: null
}
I then set about importing state.js from various components/containers in my authentication module, then removing the authState import (and, again, authState no longer exists anywhere in my source.)
I have the following in client/modules/authentication/containers/reset_password.js. Please excuse the mess, I’m separating out code into actions:
import {useDeps, composeWithTracker, composeAll} from "mantra-core"
import {authState} from "../"
import ResetPassword from "../components/reset_password.jsx"
const composer = ({context}, onData) => {
const {Accounts, Meteor} = context()
onData(null, {
onSubmit: (token, password) => new Promise((resolve, reject) => {
Accounts.resetPassword(token, password, (err) => {
if(err)
reject(err)
else
resolve()
})
})
})
}
export default composeAll(
composeWithTracker(composer),
useDeps()
)(ResetPassword)
Now, here’s the crazy bit. If I comment out:
import {authState} from "../"
my app fails to render with the following:
Error: Curry function of composeAll needs an input.
Apparently this means react-komposer is getting an undefined component. I get that. But why would that error appear if I comment out an import for a variable that is no longer defined, but go away if I uncomment the import? I’ve grepped through my entire source tree and authState is never ever mentioned except for in this single import. Why would commenting it out cause the above error and my app to not render?
I’ve tried this with 1.3 beta 11 and a checkout of the release-1.3 branch as of this morning. Same results. I’ve created a minimal app with just my authentication module. Unfortunately I don’t see the error. I’ve tried commenting out and removing unrelated modules, but I can’t find a distinct point where cutting out modules and returning them causes the error to appear. When I do add back a module and cause the error, I’ve tried stripping that module down to the bare minimum and adding in bits one-by-one. Enlightenment never comes. I guess I could add back components line-by-line but I have no guarantee that this will do anything but waste my time, and I’ve already spent hours doing just that with no luck.
I tried using --production
In that instance I get the above error and:
detailed error: TypeError: Package['service-configuration'] is undefined
I don’t doubt there’s an error in my code somewhere. But why don’t I get that error? I’d imagine that importing an undefined variable would cause an error, so to my mind I’ve removed a source of problems, and it is that removal which causes the problem. Why does the success or failure of my code hinge on whether or not the import of an undefined variable that is never used is present? I’ve even changed authState
to authStat
with the exact same results.
Thoughts on how to debug this? I’ve filed this issue. Unfortunately I’m at a loss since I can’t create a reproduction smaller than my app, which unfortunately isn’t something I can make public. This feels like it has to be a module error, but unfortunately I’m not smart enough to dig through Meteor and figure out how this is failing. I did create a zip of my app with secrets/local provisioning stripped out which I could provide to anyone with the knowledge to potentially dive into and fix a Meteor modules bug if in fact this is one, but I don’t want to just post it everywhere for everyone.
Thanks for any help, I’ve been dealing with this issue for days and it’s driving me a bit crazy.