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 (
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.
Comments
-
hi! do you have examples for these errors at hand?
0 -
Sure, here is one of the errors we got, unfortunately only in a sreenshot form:
0 -
It might be a data problem and not an error reporting problem. Are you sure your Redis storage is populated properly?
0 -
i think the same
0 -
maybe talking to the wrong redis db?
0 -
how many items are in your staging redis, @UUZSG90UR?
0 -
Gonna check on that in a moment. So that would mean that redis db is not populated correctly on dev, not on stage, right?
0 -
wherever the screenshot is from 🙂
0 -
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?
0 -
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
0 -
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.
0 -
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.
0 -
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?
0 -
nope
0 -
gimme a moment to explain
0 -
(after current meeting 😊)
0 -
@UJN2JRU4F don't leave me hanging bro 😄
0 -
haha, sorry! was a very long meeting
0 -
so, the error i see gives away that it fails while rendering the navigation. more explictly while accessing the first entry there
0 -
looks like it does not exist
0 -
which is a pretty safe bet for a data or a connection problem
0 -
it fails way before it reaches the point where you made changes
0 -
does that make sense?
0 -
are you sure it worked correctly before on that system?
0 -
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
0 -
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.
0 -
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.0 -
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.
0 -
🤔
0 -
‘nothing happens’ means a blank page or it’s gracefully ignored?
0
Categories
- All Categories
- 42 Getting Started & Guidelines
- 7 Getting Started in the Community
- 8 Additional Resources
- 7 Community Ideas and Feedback
- 75 Spryker News
- 924 Developer Corner
- 783 Spryker Development
- 88 Spryker Dev Environment
- 362 Spryker Releases
- 3 Oryx frontend framework
- 35 Propel ORM
- 68 Community Projects
- 3 Community Ideation Board
- 30 Hackathon
- 3 PHP Bridge
- 6 Gacela Project
- 25 Job Opportunities
- 3.2K 📜 Slack Archives
- 116 Academy
- 5 Business Users
- 370 Docker
- 551 Slack General
- 2K Help
- 75 Knowledge Sharing
- 6 Random Stuff
- 4 Code Testing
- 32 Product & Business Questions
- 70 Spryker Safari Questions
- 50 Random