Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sprig error on multisite #390

Closed
heychicochico opened this issue Sep 11, 2024 · 8 comments
Closed

Sprig error on multisite #390

heychicochico opened this issue Sep 11, 2024 · 8 comments
Labels
question Further information is requested

Comments

@heychicochico
Copy link

Support Request

Hello,
I followed the tutorial to build a sprig board, but I ran into two issues.

I was trying to build it on backstage.mydomain.com but none of the sprig elements work and I get this error message:
htmx:invalidPath htmx.min.js?v=1726070015:1
w @ htmx.min.js?v=1726070015:1  de @ htmx.min.js?v=1726070015:1  fe @ htmx.min.js?v=1726070015:1  he @ htmx.min.js?v=1726070015:1  (anonymous) @ htmx.min.js?v=1726070015:1  i @ htmx.min.js?v=1726070015:1
 
 I set up the same page on the primary domain and sprig works as it should.

The second issue is that on both my primary and backstage domain have this error:
htmx:invalidPath htmx.min.js?v=1726070015:1
w @ htmx.min.js?v=1726070015:1   de @ htmx.min.js?v=1726070015:1   fe @ htmx.min.js?v=1726070015:1   he @ htmx.min.js?v=1726070015:1   (anonymous) @ htmx.min.js?v=1726070015:1   i @ htmx.min.js?v=1726070015:1

Even with the error, sprig works on the primary site but not on backstage.

Craft 4.12.1 (waiting for a bugfix to upgrade to 5)
Sprig 2.13.0

Thanks!

Plugin Version

2.13.0

@heychicochico heychicochico added the question Further information is requested label Sep 11, 2024
@bencroker
Copy link
Collaborator

It sounds like the requesting domain is different from the target domain, which is disallowed by htmx. Can you show me the network tab in the browser console for the request in question, as well as some more details about the development environment you’re using?

@heychicochico
Copy link
Author

I'm using ddev
image

@bencroker
Copy link
Collaborator

Are there any details shown when you expand those two console errors?

@heychicochico
Copy link
Author

image

@heychicochico
Copy link
Author

both point this spot:
image

@bencroker
Copy link
Collaborator

Thanks, it turns out that doesn’t give much insight into the issue.

Can you please take a look at the HTML source code and check the value of the data-hx-get attribute on the div element representing the Sprig component? If the domain is different to the domain that the browser is displaying in any way then that would explain the issue. What commonly causes this is explicitly setting the @web alias or setting the CRAFT_WEB_URL environment variable. Please check if either of those have been defined and, if so, remove them and allow Craft to determine the web URL itself.

@heychicochico
Copy link
Author

Hi Ben, I removed the @web alias and now sprig works on the backstage site. Thanks for that!

Do you know any implications for removing it? I don't believe we're calling @web anywhere. It just shows up here:
image

Also, the first error is still kicking around, but again, sprig still functions.
image

Additionally

@bencroker
Copy link
Collaborator

bencroker commented Sep 16, 2024

Glad to hear it!

I already have a bug report open for that in craftcms/cms#15739.

I’m not sure what the syntax error is about but it seems unrelated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants