Laravel-Backpack / basset

Better asset helpers for Laravel apps.
MIT License
151 stars 10 forks source link

Cannot assign null to property Backpack\Basset\Helpers\CacheMap::$map of type array #107

Closed BernhardK91 closed 3 months ago

BernhardK91 commented 5 months ago

Hey there,

While testing in a test pipeline we are getting the folling TypeError:

Cannot assign null to property Backpack\Basset\Helpers\CacheMap::$map of type array

Is there a way to disable basset while running the tests?

Best regards, Bernhard

pxpm commented 5 months ago

Hey @BernhardK91 can you try by setting the .env variable BASSET_DEV_MODE=true ?

Let me know if that helps.

Cheers

BernhardK91 commented 5 months ago

That sounds like it is the setting I was searching for. Unfortunately, the error occurred more or less randomly. So I will close the issue for now and only reopen if the error occurs again.

Thank you very much for your help!

BernhardK91 commented 5 months ago

Unfortunately, the issue still occurs, even with added BASSET_DEV_MODE=true to the pipeline's .env file.

Btw: The error occurs once (maximum twice) in 450 tests, and it is every time another tests, but always tests that check our admin panel.

pxpm commented 5 months ago

Hey @BernhardK91 Is it possible that you can provide a simple repo with only 1 of the tests that fail, and make it fail there in a clean repo? I say that because it may be something dependant on your environment setup, that I will not be able to replicate and attempt a fix.

If we can reproduce the error in a clean environment, even if it only happen "once in a while" I can put a script to run the test 1M times until it fails and I may try to trace back the issue.

I would focus to know the reason why null is there while an array is expected. Is the file deleted in some tests ? Maybe the file takes a little bit to create and the "check" run before the file operation finishes ?

🤷 Let me know what kind of info you can provide me to help me debug this.

Cheers

BernhardK91 commented 5 months ago

Hi @pxpm,

Thank you for your fast and detailed response. I will try if I can reproduce the error in a clean repo.

Run the tests "endless" until it fails is a good idea, I will also try that myself.

I'll let you know as soon as I have any more details on that.

Have a good one!

promatik commented 3 months ago

Hey everyone! This issue was not updated for the last 2 months, so I'll close it for now, if someone has any update for this one please re-open 🙌

BernhardK91 commented 3 months ago

Yeah, sure, currently I was not able to reproduce outside of Bitbucket Pipeline. I will reopen when I have any updates.