What are the Slack Archives?

It’s a history of our time together in the Slack Community! There’s a ton of knowledge in here, so feel free to search through the archives for a possible answer to your question.

Because this space is not active, you won’t be able to create a new post or comment here. If you have a question or want to start a discussion about something, head over to our categories and pick one to post in! You can always refer back to a post from Slack Archives if needed; just copy the link to use it as a reference..

Hey guys, we are facing an issue with error logging on local machines vs stages: some fatal errors (

UUZSG90UR
UUZSG90UR Posts: 14 πŸ§‘πŸ»β€πŸš€ - Cadet

Hey guys,
we are facing an issue with error logging on local machines vs stages: some fatal errors (mostly null-pointers) are not visible in local environment, neither in the browser, nor in the logs. The moment code gets deployed to dev, yves frontend falls apart and only shows stacktrace. There must be something messed up in the configs, which makes development mode ignore the errors completely, but we could not find anything suspicious while comparing env configs with local configs. Would appreciate any help.

Β«134

Comments

  • hi! do you have examples for these errors at hand?

  • UUZSG90UR
    UUZSG90UR Posts: 14 πŸ§‘πŸ»β€πŸš€ - Cadet

    Sure, here is one of the errors we got, unfortunately only in a sreenshot form:

  • It might be a data problem and not an error reporting problem. Are you sure your Redis storage is populated properly?

  • i think the same

  • maybe talking to the wrong redis db?

  • how many items are in your staging redis, @UUZSG90UR?

  • UUZSG90UR
    UUZSG90UR Posts: 14 πŸ§‘πŸ»β€πŸš€ - Cadet

    Gonna check on that in a moment. So that would mean that redis db is not populated correctly on dev, not on stage, right?

  • wherever the screenshot is from πŸ™‚

  • UUZSG90UR
    UUZSG90UR Posts: 14 πŸ§‘πŸ»β€πŸš€ - Cadet

    that's from stage, where the error occures. The thing is, the twig file which the error is pointing at, actually had an error. So I don't get the connection with the db.. If there is a null pointer in the code, shouldnt spryker throw an error in development mode on a local machine?

  • If the data is present in Redis on your local development system, there will be no error. If it is missing (what we suspect is happening on your staging system) the error shows up due to unmet data dependencies

  • UUZSG90UR
    UUZSG90UR Posts: 14 πŸ§‘πŸ»β€πŸš€ - Cadet

    Oh, my bad, I didn't explain what the error was about correctly. There was a place in the twig file where i was trying to calculate the amount of items in a customer's wishlist. And i was accessing that wishlist by saying something along the lines of wishlistCollection[0].numberOfItems. This worked fine on local machines and no error has been logged for any user. When we deployed it to staging environment and logged in with a user, who had no wishlists connected to his accoung, this error popped up, because his wishlistCollection is null.

  • UUZSG90UR
    UUZSG90UR Posts: 14 πŸ§‘πŸ»β€πŸš€ - Cadet

    This is just one example, but we had other ones, where the db could not have had any items stored for whatever i was accessing. Sometimes it didn't even have to do anything with the data, but was all about trying to access an argument that was not passed to a molecule.

  • U0145CP9Q6Q
    U0145CP9Q6Q Posts: 123 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited June 2020

    I think the problem is not in redis. The problem is that the errors are not showing in browser in developer mode. Which settings should be changed to show this? Spryker works like in production mode and hide errors. what could be the reason?

  • gimme a moment to explain

  • (after current meeting 😊)

  • UUZSG90UR
    UUZSG90UR Posts: 14 πŸ§‘πŸ»β€πŸš€ - Cadet

    @UJN2JRU4F don't leave me hanging bro πŸ˜„

  • Unknown
    edited June 2020

    haha, sorry! was a very long meeting :D

  • so, the error i see gives away that it fails while rendering the navigation. more explictly while accessing the first entry there

  • Unknown
    edited June 2020

    looks like it does not exist

  • which is a pretty safe bet for a data or a connection problem

  • Unknown
    edited June 2020

    it fails way before it reaches the point where you made changes

  • does that make sense?

  • are you sure it worked correctly before on that system?

  • UUZSG90UR
    UUZSG90UR Posts: 14 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited June 2020

    That specific error you are seeing was caused by the following lines in code:

    {% set shoppingListQuantity = data.shoppingListCollection.shoppingLists
        ? data.shoppingListCollection.shoppingLists[0].numberOfItems
        : null
    %}
    

    The problem being that shoppingLists was an empty array for a customer without any shopping lists. I didn't think of that and tried to access numberOfItems of the first element of an empty array. Since the first element of an empty array is null, it was totally legit to throw a null pointer at me. However, that did not happen on local machine

  • UUZSG90UR
    UUZSG90UR Posts: 14 πŸ§‘πŸ»β€πŸš€ - Cadet

    We deploy that code, unaware of a missing null check and it breaks on dev when we log in with a test account, which doesn't have any shopping lists.

  • UUZSG90UR
    UUZSG90UR Posts: 14 πŸ§‘πŸ»β€πŸš€ - Cadet
    edited June 2020

    This was just one example. But i can reproduce the same exact situation without ever trying to access the database.

    For example: if I explicitly create a variable, set it to null and then try to access something inside this variable like so:
    {% set test = null %}
    {{ test.runtest }}
    Nothing happens on my local machine. The shop runs a template where i explicitly caused a null pointer as if nothing is wrong. The moment i deploy that i get a white screen with an error message pointing at the line of code which has a null pointer.

  • UUZSG90UR
    UUZSG90UR Posts: 14 πŸ§‘πŸ»β€πŸš€ - Cadet

    This makes me think that it must be an error logging problem. I can see the error in the code and also on staging environment. But there are no error messages issued on local machine.

  • πŸ€”

  • β€˜nothing happens’ means a blank page or it’s gracefully ignored?