mattermost / mattermost-mobile

Next generation iOS and Android apps for Mattermost in React Native
https://about.mattermost.com/
Apache License 2.0
2.25k stars 1.36k forks source link

Missing logError argument in checkUpgradeType function call (since v1.28.0) #4038

Closed xRahul closed 1 year ago

xRahul commented 4 years ago

Error coming during login since v1.28.0

Reference: https://github.com/mattermost/mattermost-mobile/blob/217ef59f1c31ff4bac7e35112f7ecdaa328c50bb/app/screens/select_server/select_server.js#L112

Method: https://github.com/mattermost/mattermost-mobile/blob/217ef59f1c31ff4bac7e35112f7ecdaa328c50bb/app/utils/client_upgrade.js#L9

Error:

TypeError: logError is not a function
    at checkUpgradeType (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:504174:7)
    at SelectServer.componentDidUpdate (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:547430:68)
    at commitLifeCycles (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:24211:28)
    at commitLayoutEffects (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:26543:13)
    at Object.invokeGuardedCallbackImpl (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:12683:16)
    at invokeGuardedCallback (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:12779:37)
    at commitRootImpl (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:26350:15)
    at unstable_runWithPriority (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:32478:18)
    at runWithPriority (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:16229:16)
    at commitRoot (http://localhost:8081/index.bundle?platform=android&dev=true&minify=false:26212:9)

Error triggered due to the following error at line: https://github.com/mattermost/mattermost-mobile/blob/217ef59f1c31ff4bac7e35112f7ecdaa328c50bb/app/utils/client_upgrade.js#L13

"Error: Dynamic require defined at line 3; not supported by Metro
    at /Users/rahul.jain/Documents/mattermost-mobile/.vscode/.react/index.bundle:504189:13
    at lazyRequire (/Users/rahul.jain/Documents/mattermost-mobile/.vscode/.react/index.bundle:504190:6)
    at Object.get [as gt] (/Users/rahul.jain/Documents/mattermost-mobile/.vscode/.react/index.bundle:504198:19)
    at checkUpgradeType (/Users/rahul.jain/Documents/mattermost-mobile/.vscode/.react/index.bundle:504162:27)
    at SelectServer.componentDidUpdate (/Users/rahul.jain/Documents/mattermost-mobile/.vscode/.react/index.bundle:547430:68)
    at commitLifeCycles (/Users/rahul.jain/Documents/mattermost-mobile/.vscode/.react/index.bundle:24211:28)
    at commitLayoutEffects (/Users/rahul.jain/Documents/mattermost-mobile/.vscode/.react/index.bundle:26543:13)
    at Object.invokeGuardedCallbackImpl (/Users/rahul.jain/Documents/mattermost-mobile/.vscode/.react/index.bundle:12683:16)
    at invokeGuardedCallback (/Users/rahul.jain/Documents/mattermost-mobile/.vscode/.react/index.bundle:12779:37)
    at commitRootImpl (/Users/rahul.jain/Documents/mattermost-mobile/.vscode/.react/index.bundle:26350:15)"
enahum commented 4 years ago

@xRahul would you mind submitting a PR to fix it? That would be great if you can

xRahul commented 4 years ago

@enahum What should be the fix here? Personally, I've just put an if/else over logError such that if it exists, log it, or skip logging on error. If we need to pass it, would I find it in same place, as in, props.action?

Also, not sure why the error: Error: Dynamic require defined at line 3; not supported by Metro is coming. Haven't really kept up with the latest version of react.

enahum commented 4 years ago

@xRahul probably the issue is with the semver import, maybe try to change it for import semver from 'semver/preload';

larkox commented 1 year ago

This doesn't seem to be applicable any longer on V2.