Skip to content
This repository has been archived by the owner on Nov 15, 2020. It is now read-only.

Asset manifest fails to load in Local By Flywheel with a self-signed cert #5

Closed
richaber opened this issue Mar 30, 2018 · 2 comments
Closed
Labels

Comments

@richaber
Copy link

Hello, I am using "Local by Flywheel" for local development, with a self-signed certificate.

Local by Flywheel is a Docker based dev environment. It uses separate containers to run individual WordPress installations, and a separate "router" container to intercept and reverse proxy HTTPS connections to the appropriate WP install container. In this environment, with a self signed certificate, file_get_contents() fails to read the manifest, as the curl connection is refused.

\WPGraphiQL::get_app_manifest():63, uses file_get_contents to read the asset-manifest.json via URL, thusly:

$manifest = file_get_contents( plugins_url( 'wp-graphiql/assets/app/build/asset-manifest.json' ) );

Due to the refused connection, the GraphiQL admin screen is blank, and PHP logs the following:

PHP Warning:  file_get_contents(https://dev.local/wp-content/plugins/wp-graphiql/assets/app/build/asset-manifest.json): failed to open stream: Connection refused in /app/public/wp-content/plugins/wp-graphiql/wp-graphiql.php on line 63
PHP Stack trace:
PHP   1. {main}() /app/public/wp-admin/admin.php:0
PHP   2. require_once() /app/public/wp-admin/admin.php:216
PHP   3. do_action() /app/public/wp-admin/admin-header.php:97
PHP   4. WP_Hook->do_action() /app/public/wp-includes/plugin.php:453
PHP   5. WP_Hook->apply_filters() /app/public/wp-includes/class-wp-hook.php:310
PHP   6. WPGraphiQL->enqueue_react_app() /app/public/wp-includes/class-wp-hook.php:286
PHP   7. WPGraphiQL->get_app_stylesheet() /app/public/wp-content/plugins/wp-graphiql/wp-graphiql.php:112
PHP   8. WPGraphiQL->get_app_manifest() /app/public/wp-content/plugins/wp-graphiql/wp-graphiql.php:74
PHP   9. file_get_contents() /app/public/wp-content/plugins/wp-graphiql/wp-graphiql.php:63

However, if I modify \WPGraphiQL::get_app_manifest():63 to read the manifest directly from the filesystem, everything works as intended:

$manifest = file_get_contents( dirname( __FILE__ ) . '/assets/app/build/asset-manifest.json' );

I am unsure as to why it would be necessary to read the manifest file into PHP via URL, since it is available in the plugin assets, and can be read directly from the filesystem. Perhaps reading the manifest file directly from the filesystem could be a better route?

@jasonbahl
Copy link
Contributor

@richaber Thanks for the detailed issue!

Can you open a PR? I'd be happy to merge.

@jasonbahl jasonbahl added the bug label Mar 30, 2018
@jasonbahl
Copy link
Contributor

(and I definitely agree getting the manifest from the filesystem is the way to go here. . .not sure why I did it the other way to begin with 🤔)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants