[Solved] Updated parse to 3.10 login code no longer works

So I’m in the process of updating an express/react app I have which was built on parse-server 2.8 to the latest version I did notice that 3.0 introduced breaking changes but I was already using promises for all my cloud code so I figured I’m going to update.

So I updated my app and now I can’t login every time I try to I get error unauthorized I’ve tried to debug and get something in the console to no avail node does not provide any errors besides the error unauthorized.

My database is working I can view it via mongo cli and via parse-dashboard but my app for some reason just refuses to connect to it.

This is my config.json for parse server:

{
    "appId": "appName",
    "cloud": "./cloud/main.js",
    "masterKey": "*****",
    "javascriptKey": "*****",
    "serverURL": "http://localhost:1337/parse",
    "logLevel": "VERBOSE",
    "verbose": 1,
    "startLiveQueryServer": true,
    "databaseURI": "mongodb://localhost:27017/bitnami_parse",
    "databaseOptions": {
        "useNewUrlParser": true
    }
}

This is what logs out when I run parse-server config.json

allowClientClassCreation: true
appId: turn2
cacheMaxSize: 10000
cacheTTL: 5000
cloud: ./cloud/main.js
customPages: {}
databaseOptions: {"useNewUrlParser":true,"useUnifiedTopology":true}
databaseURI: mongodb://localhost:27017/bitnami_parse
enableAnonymousUsers: true
expireInactiveSessions: true
graphQLPath: /graphql
host: 0.0.0.0
javascriptKey: ***REDACTED***
logLevel: VERBOSE
logsFolder: ./logs
masterKey: ***REDACTED***
masterKeyIps: []
maxUploadSize: 20mb
mountPath: /parse
objectIdSize: 10
playgroundPath: /playground
port: 1337
protectedFields: {"_User":{"*":["email"]}}
revokeSessionOnPasswordReset: true
schemaCacheTTL: 5000
serverURL: http://localhost:1337/parse
sessionLength: 31536000
startLiveQueryServer: true
verbose: true
allowCustomObjectId: false
collectionPrefix:
directAccess: false
enableExpressErrorHandler: false
enableSingleSchemaCache: false
mountGraphQL: false
mountPlayground: false
preserveFileName: false
preventLoginWithUnverifiedEmail: false
scheduledPush: false
skipMongoDBServer13732Workaround: false
verifyUserEmails: false
jsonLogs: false
level: undefined

[22476] parse-server running on http://localhost:1337/parse

This is my login function:

logIn = async(values, history) => {
        const { email, password } = values;
        return await Parse.User.logIn(email, password)
            .then(() => {
                const currentUser = Parse.User.current();
                this.setState({ currentUser, isModalOpen: false });
                if (currentUser.attributes.isAdmin) {
                    history.push(`/my-dashboard/${currentUser.id}`);
                } else {
                    history.push(`/my-application/${currentUser.id}`);
                }
            })
            .catch(error => {
                return alert(error);
            });
    };

Any idea what could be the issue? I’ve tried it on several computers windows/osx and both give me the same issue.

If I run my old version 2.8 it works fine but I want to upgrade it to the latest version.

Thanks.

So I’m a moron I updated my package.json so it could download the latest version of parse, parse-server and parse-dashboard and ran npm i without nuking my node_modules so I assume it was having a conflict with the new version and old versions of the packages.

Carry along nothing to see here besides my stupidity, thanks.

1 Like