futurice/pepperoni-app-kit

Error: Possible Unhandled Promise Rejection (id: 0): Cannot read property 'registerColorForKey' of undefined

simonjblack opened this issue · 4 comments

Installing a fresh build with the yields the below error when amending the env.js file with Auth0 details (which have been tested with another app and work there).

This was replicated with the same process: git clone > npm install > cp env.example.js env.js > (cd ios; pod repo update; pod install) > react-native upgrade > update env.js with Auth0 details

Possible Unhandled Promise Rejection (id: 0):
Cannot read property 'registerColorForKey' of undefined
TypeError: Cannot read property 'registerColorForKey' of undefined
    at http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:92520:11
    at Array.forEach (native)
    at Auth0Lock.customizeTheme (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:92518:22)
    at Object.showLogin (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:92413:6)
    at Constructor.componentWillReceiveProps (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:18927:7)
    at ReactCompositeComponentWrapper.updateComponent (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:31649:6)
    at ReactCompositeComponentWrapper.receiveComponent (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:31582:6)
    at Object.receiveComponent (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:29752:18)
    at ReactCompositeComponentWrapper._updateRenderedComponent (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:31785:17)
    at ReactCompositeComponentWrapper._performComponentUpdate (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:31763:6)
    at ReactCompositeComponentWrapper.updateComponent (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:31682:6)
    at ReactCompositeComponentWrapper.performUpdateIfNecessary (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:31596:6)
    at Object.performUpdateIfNecessary (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:29786:18)
    at runBatchedUpdates (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:29390:17)
    at ReactNativeReconcileTransaction.perform (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:30132:12)
    at ReactUpdatesFlushTransaction.perform (http://localhost:8081/index.ios.bundle?platform=ios&dev=true&minify=false:30132:12)

Update: it appears to be an issue with the customizations on Auth0 lock after running react-native upgrade.

A workaround which appears to fix the issue is: after the steps above, run rnpm link react-native-lock in project directory but do not overwrite the existing pod file (Note that rnmp link will break the project so don't do that). I'm guessing the upgrade broke the link to the customized Auth0 fork, but I'm a relative newbie so would be keen to hear any more detailed explanations.

(continued...) The above fixes it for iOS but not for Android:

screen shot 2016-07-25 at 2 37 32 pm

I suspect that this is related to this bug #77. Will retest once that bug is fixed

Hi @simonbdev is the issue still happening with the current version of pepperoni for you? We also made Auth0 now optional so you won't run into this problem anymore if you don't want to use it.

Closing this now since it doesn't seem to be an issue anymore after removing Auth0 as a native dependency