When sourcing form a site with Basic credentials I'm getting 401 unauthorized on 1 image then the dev server panics out. I'm wondering if the get request isn't being passed the basic auth credentials.
Same here!
To reproduce, here is the only change on the recomended starter;
gatsby-config.js
...
{
resolve: `gatsby-source-wordpress-experimental`,
options: {
url: process.env.WPGRAPHQL_URL,
verbose: true,
...
auth: {
htaccess: {
username: process.env.HTTPBASICAUTH_USERNAME,
password: process.env.HTTPBASICAUTH_PASSWORD,
},
},
...
Error while running gatsby develop or gatsby build with or without gatsby clean :
info gatsby-source-wordpress Unrecoverable error occured while
fetching media item #42
Media item link: http://gatsby-wp-demo.flywheelsites.com/element
or-17/single-stroke-ar-nazeh-2/
ERROR
failed to process http://gatsby-wp-demo.flywheelsites.com/wp-content/uploads/2020/06/single-stroke-ar-nazeh-2.png
HTTPError: Response code 401 (Restricted)
I have experienced this a few times, and I solved it by talking to the hosting provider about the firewall that they may have set up, and the second one is when I use Cloudflare
Same error here. Image fetch fails with password protect in WP Engine

This is fixed in [email protected]! Thanks for the report
Tested and working now. Thanks to you!
It seems this issue is back in newer versions. Using any version up until 1.2.1 (including) - no problem. Using version 1.2.2 and above it return a 401 when trying to fetch a MediaItem from the server (WPEngine in my case):
failed to process https://afhl.wpengine.com/wp-content/uploads/2020/07/blogBcg.jpeg
HTTPError: Response code 401 (Unauthorized)
Any thoughts on this?
Yesterday I updated the plugin and got this error a few times, it was somewhat inconsistent. Finally I didn't report it because it seems to have disappeared but I'm not entirely sure. I also use WP Engine.
Ahh, 馃 you know there was a release recently which changes things to only add the auth headers if the WP domain is the same as the domain of the file request. I think I know what's going on here and should have a fix for this shortly
I released a bug fix in [email protected]. Sorry for this regression! I have it near the top of my todolist to write comprehensive int tests for images & images in html. The current tests are lacking here. Closing this but please let me know if you run into other problems! I manually tested this using htpass on WPEngine and it looked like it works great 馃憤
Worked like a charm, finally, I can actually test how much work would this be :)
Yep, seems to work now. Thanks @TylerBarnes!
Most helpful comment
I released a bug fix in
[email protected]. Sorry for this regression! I have it near the top of my todolist to write comprehensive int tests for images & images in html. The current tests are lacking here. Closing this but please let me know if you run into other problems! I manually tested this using htpass on WPEngine and it looked like it works great 馃憤