Portal Pages Not Working [Failed to initialize: TypeError: Failed to fetch]

Hi there,

I’m new to Ghost theming and have been trying to build a customized theme for my website. However, on a recent test of the “Subscribe” button on the website, I just found out that it didn’t work at all.

When I went to Settings > Members > Portal to take a look, the “SignUp” and “Account” tabs both show a preview of my Homepage instead of a popup modal of the Portal screens.

In the DevTool console, there were 2x issues:

  1. GET https://adultingstuffz.com/members/api/member/ net::ERR_TOO_MANY_REDIRECTS
  2. [Portal] Failed to initialize: TypeError: Failed to fetch

The only “drastic:” thing I have done that I assume may have caused this, was to “Delete All Content” and then a “Re-Import of Data” to reset the data in Ghost. But I’m unsure if that was a key cause of this issue.

Currently, there is only one page and one post published.

Hope someone can help me with this issue. Thank you and much appreciated!

  • URL: https://adultingstuffz.com/
  • Ghost 4.1.2
  • Installed via DigitalOcean 1-Click Apps
  • Node v14.16.0, MySQL, macOS Catalina & Chrome 89.0.4389.90
  • What errors or information do you see in the console?
  • What steps could someone else take to reproduce the issue you’re having?

Can you try clearing your browser cache in case your browser has somehow cached a 301 redirect? net::ERR_TOO_MANY_REDIRECTS suggests something is wrong with how the members API request is occurring, either a historic redirect that has been cached or a config problem somewhere that’s causing a redirect.

Hi Kevin,

I’ve just cleared the browser cache. Same issue.

Though I’m unsure whether it will affect, I am actually using CloudFlare as a middleman for DNS redirect with Full (strict) SSL implementation.

Is your proxy server correctly setting the X-Forwarded-Proto header?

Hmm… I think I am on any proxy server or anything. Very generalised basic settings on CloudFlare, which I do not think will be the main factor though. Just curious… does (1) potentially affects (2)?

  1. GET https://adultingstuffz.com/members/api/member/ net::ERR_TOO_MANY_REDIRECTS
  2. [Portal] Failed to initialize: TypeError: Failed to fetch

I think I am on any proxy server or anything

Ghost needs a proxy server to run properly. You likely have nginx or apache running as a proxy server on your VPS alongside your Ghost instance.

Just curious… does (1) potentially affects (2)?

Yes, 2 is a direct consequence of 1, they are both essentially the same error.

Hmm… now that is a bummer… I just did the 1-click app install via DigitalOcean. And internally it set up “Let’s Encrypt”, and that is about what i know that is being installed on my Droplet. Not running a VPS setup.

Any potential resolution? As doing a “ghost doctor” via SSH reveals no issue though.

In that case your nginx configuration should have the correct X-Forwarded-Proto header setup. As you’re using Cloudflare perhaps try clearing the cache there, waiting a few mins, clearing the cache on your browser then trying again? If Cloudflare somehow cached a 301 redirect then the earlier browser cache clear wouldn’t have had any effect.

Droplet/VM/VPS are all the same thing :)

Hi Kevin,

I am not sure what actually happened. Never do any updates to the code nor CloudFlare.

Currently, it just seemed to work. The only retaining error is:

  1. Failed to load resource: the server responded with a status of 401 () – /members/api/member/:1

Not entirely sure if it is a different error or problem altogether.

In that case I expect it was a redirect being cached somewhere and the cache expired.

Failed to load resource: the server responded with a status of 401 () – /members/api/member/

The 401 Unathenticated response is expected and not an error, it’s the API saying no member is currently authenticated/logged in.

1 Like

Thanks so much for the help nonetheless! :wink: