App working in development but not in published state


#1

Hi guys.

I’m building an app using firebase. My app is functioning fine in my development environment using the expo XDE. However when I publish it to the app store it is crashing for some reason. Is there any way I can generate a crash report via expo?

export const saveProfile = (data) => {

    return (dispatch) => {
        dispatch({type: SAVE_PROFILE});
        curUser = firebase.auth().currentUser.uid;
        docRef = firebase.firestore().doc("users/" + curUser);
        docRef.set( data , { merge: true })
        .then(() => {
            dispatch({type: SAVE_PROFILE_SUCCESS});
            alert('User profile updated successfully', '' , {text: 'OK'});
        })
        .catch(() => {
            dispatch({type: SAVE_PROFILE_FAIL});
            alert('Please try again','', {text: 'OK'});
        })
    }
}

That’s the code I’m using. I just pass an object as data and then want to merge it with the uid document of my users collection.
This works on local development and I see the alert message to which I can dismiss and carry on. However in it’s published state, I don’t see this at all. I press my save button which sends the above action but it instantly crashing upon pressing the button

Anyone have any ideas what could possibly be causing this behaviour?


#2

can you share your published app expo URL here?


#3

To debug this, run “exp start --no-dev --minify” and it will emulate the published state


#4

the thing you probably want to setup to track crashes is sentry.

here are some instructions on how to get it setup with your app.
https://docs.expo.io/versions/latest/guides/using-sentry.html


#5

Wow wasn’t expecting such quick responses.

@ccheever Thanks for your suggestion of sentry. This looks like what I was looking to implement to track any future problems

@bacon Thanks man, this is definitely the commands I needed. However I’m still not seeing anything when the app crashes. It essentially just reloads the whole app with no logs or anything. Is there anything else I can do?

Thanks again guys


#6

Thanks I’ve fixed it.

I’d left curly braces inside of the parameters of my onButtonPress function. I’d left them there when I’d removed an object literal I was passing.

function ({}) {
}

For some reason, In development mode, the function executes no problem. However in a non development state, the app crashes. The error only shows when I set up the environment that @bacon suggested.

I’ve since removed the braces I forgot about and the app runs perfectly. Thanks again


closed #7

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.