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

[an error occurred while processing the directive] printed on all pages #46

Closed
jamiematrix opened this issue Oct 20, 2022 · 7 comments
Closed
Labels
bug Something isn't working

Comments

@jamiematrix
Copy link

Describe the bug

We get the message of [an error occurred while processing the directive][an error occurred while processing the directive] printed at the the of all pages. Assets still update (HMR) fine but this message appears at the top of each page just under the opening <body> tag.

Using XDEBUG with DDEV I can see Guzzle has issues reaching the address http://localhost:3000/__vite_ping followed by the error "cURL error 7: Failed to connect to localhost port 3000: Connection refused (see https://curl.haxx.se/libcurl/c/libcurl-errors.html) for http://localhost:3000/__vite_ping"

I think this is somewhat related to #37 but I can get assets to build and update fine. Setting checkDevServer to false has no effect. It's just this message that appears.

To reproduce

Steps to reproduce the behaviour:

  1. Open any templated page.

Expected behaviour

No error at all

Versions

  • Plugin version: 1.0.28
  • Craft version: 3.7.57
@jamiematrix jamiematrix added the bug Something isn't working label Oct 20, 2022
@khalwat
Copy link
Contributor

khalwat commented Oct 21, 2022

If it can't connect to localhost on port 3000 that sounds to me like some kind of a local dev issue? What host & port is the Vite dev server actually running off of?

@khalwat
Copy link
Contributor

khalwat commented Oct 21, 2022

I'm pretty sure the [an error occurred while processing the directive] may not have anything to do with the plugin? Could it be an Nginx error, where it's trying to use SSI but SSI is not enabled in the Nginx config?

@jamiematrix
Copy link
Author

As far I as I can see we've followed the installation instructions to get the plugin setup. Majority of the team are using DDEV if that makes a difference (I've made sure those extra DDEV specific steps are in there for the DDEV config).

Most of my assumption it's the plugin is this is the first time we've used the plugin and the site wasn't showing the error before. Initially I thought it wasn't the plugin as I disabled it in /admin but the error remained.

devServerInternal in the config is set to http://localhost:3000
server.origin is set to http://localhost:3000 and server.port is set to 3000 in vite.config.js

@jamiematrix
Copy link
Author

Not sure why it wasn't showing before but now the browser console is listing web socket errors connecting to the DDEV site URL and localhost (both port 3000).

I'll go through the config again to check it over

@jamiematrix
Copy link
Author

I've set devServerInternal to use https and now those web socket errors have gone. Still get the [an error occurred... message though

@jamiematrix
Copy link
Author

Think we found the issue.

We've been using your template scaffolding for some of our newer sites and it looks like the critical-css (https://github.com/nystudio107/craft/blob/craft-vite/cms/templates/_boilerplate/_partials/critical-css.twig) file was causing the problem.

We're using NGINX with DDEV so it's trying to load the critical css (which isn't in place). Not sure why this site is getting the error and no other site is with DDEV (I changed to DDEV when Nitro was 'dropped').

@khalwat
Copy link
Contributor

khalwat commented Oct 24, 2022

Cool, yep, that's what I figured it would be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants