statamic / eloquent-driver

Provides support for storing your Statamic data in a database, rather than flat files.
https://statamic.dev/tips/storing-content-in-a-database
MIT License
104 stars 75 forks source link

Asset search error with specific strings #265

Closed DanielDarrenJones closed 5 months ago

DanielDarrenJones commented 5 months ago

Hi, we are encountering an issue when searching for specific strings in the asset browser, I originally thought this might be a core Statamic issue, however, I did a deep dive with @duncanmcclean and the issue only seems to happen when asset_containers and assets are set to use eloquent, hence reporting here.

Here are some videos from our client that show the error happening: https://we.tl/t-NjwjIvX3fr basically when searching an error is thrown in the console which then blocks selecting assets or clicking any other buttons, and forces you to reload the page. In testing against our application, it only seems to be when we search for a number or a dash, although it's possible other special chars may also cause issues.

I believe the issue is caused by either a folder or filename, or potentially something else in our assets, as we couldn't replicate this on Duncan's sandbox project, however, the same issue is happening on both our local and production environment of this project. We have 3 filesystems set up the same way and it only seem to be happening in one when we search specific numbers eg '219' which is why I thinks it's related to the contents of the filesystem.

Let me know if you need a zip of the code, and/or a dump of the DB, or alternatively if a call to demo the issue would be helpful? I have attached a log file of the error in the console, which may help slightly: pelorus-travel.test-1712595941203.log

ryanmitchell commented 5 months ago

Anything in your laravel log?

DanielDarrenJones commented 5 months ago

Anything in your laravel log?

Unfortunately not, cleared the log then got the error again, but the log is empty.

DanielDarrenJones commented 5 months ago

Looks like this only happens from a fresh text search too: https://www.loom.com/share/86c22349d443408a9c862e1b5c15ff05 not sure if this will help track it down

ryanmitchell commented 5 months ago

Going by this screenshot you seem to have some duplicate entries:

CleanShot 2024-04-08 at 18 59 24@2x

When you remove the duplicates does it work as expected?

DanielDarrenJones commented 5 months ago

@ryanmitchell That is possible, the client has also reported when uploading sometimes it duplicates entries, I just hadn't gotten into looking at that one yet - I don't think this is related though, as I tested uploading a single one of the images to the other filesystem and it errored again even though there wasn't a duplicate in there

ryanmitchell commented 5 months ago

Struggling to see the issue on my local install - could we set up a call so I can see it (or even if I'm able to get temporary access to see it?)

ryanmitchell commented 5 months ago

Just for visibility we narrowed this issue down to duplicate ids causing a Vue error. Going to close this off as its resolved.