aerni / statamic-advanced-seo

Comprehensive SEO addon for Statamic with flexibility in mind
https://statamic.com/addons/aerni/advanced-seo
10 stars 5 forks source link

Multi-site error in Windows #60

Closed Narretz closed 1 year ago

Narretz commented 1 year ago

This is a follow-up to #56

The error persists, and I'm pretty sure it's a problem with advanced-seo, not the multisite feature. Even after converting a clean statamic 3 install to multisite, I get the error seen here: https://flareapp.io/share/omwrgWR5#F109

From what I can tell, the problem is in Aerni \ AdvancedSeo \ Data \ SeoDefaultSet :blueprint function. https://github.com/aerni/statamic-advanced-seo/blob/2c635c13fdc74f7a35d3ac82dda90bc2629b88e3/src/Data/SeoDefaultSet.php#L204

When you go to "cp/advanced-seo/site/general", and you don't have multisite configured, "{$this->type}::{$this->handle}" will be "site::general", but when you multisite configured, "{$this->type}::{$this->handle}" will be for example "site/default::general", for which no blueprint exists, and the error is thrown. The same is true for collections settings etc.

What's noteworthy is that this only happens the second time after you go to "cp/advanced-seo/site/general", because advanced-seo will create the localizations initially.

aerni commented 1 year ago

Hmm, I'm using this addon on a couple of multi-sites and never came across this issue. Can you provide steps to reproduce this on a fresh installation?

Narretz commented 1 year ago

Hi @aerni,

here's a video with the error.

https://github.com/aerni/statamic-advanced-seo/assets/1153097/e1d7f477-d634-4738-bacc-cac7be53a180

It happens after creating an app with these steps:

Steps to repro

-> error appears

I'm running out of ideas tbh. Maybe it's a Windows thing?

aerni commented 1 year ago

Thanks for the steps. But I'm afraid that I still can't reproduce the issue. No duplicate ID's in the sidebar, either. I really want to fix this for you, but it's pretty hard without being able to replicate it myself.

Any chance that you can whip up a repo that isolates and reproduces the problem?

Narretz commented 1 year ago

Hi @aerni thanks for looking into this (again)!

The repo is here: https://github.com/Narretz/advanced-seo-multi

I didn't commit the vendor / node_modules files, so you need to install them before you make the tests.

If it still doesn't reproduce for you, it must be an environment thing.

aerni commented 1 year ago

I just gave your sample repo a try and followed the instructions you provided above. Still no luck in reproducing the issue. It must be an environment thing or some other strange issue. Do you run into this on local only? Have you tried on a staging or production server?

Narretz commented 1 year ago

It shouldn't come as a surprise (but it did) that this was a Windows / Unix path error. See #80 for a fix