• Resolved svfjk

    (@svfjk)


    Hi there,

    I’ve tried to install Site Kit, but I got hit with the ‘ol fatal error “Missing site_id or site_code” during the auth stage of the setup. Before reaching the “verify site ownership” stage, it returns: PHP Fatal error: Uncaught Exception: Missing site_id or site_code parameter for setup URL. in /usr/share/nginx/web/app/plugins/google-site-kit/includes/Core/Authentication/Google_Proxy.php:139

    If I debug the exception, site_code is populated, but site_id is missing.

    I have the latest version of WordPress and Sitekit.

    In site health, I have error regarding auto updates, and that I have changed the default timezone.

    This error only occurs in prod. I’m able to complete the auth in my development environment. Everything is dockerised, so all settings and versions (including deps) are the same, same site health errors. The only thing that I can think of that differs from prod is that I’m using a different domain.

    I have reset the plugin and even reinstalled the plugin to no avail – still the same error.

    I have used the troubleshoot plugin, and deactivated all plugins – still the same error.

    I have a http(s) logger that checks all outbound server requests, and it seems that the call to https://sitekit.withgoogle.com/o/oauth2/site/ returns both site_id and site_secret: "body": "{"site_id":"REACTED.apps.sitekit.withgoogle.com","site_secret":"REDACTED"}".

    I just tried to change the WP_HOME on my dev environment to my prod domain, and now I get the same error as in prod.

    I don’t know how to proceed…

    Regards.

Viewing 13 replies - 1 through 13 (of 13 total)
  • Plugin Support James Osborne

    (@jamesosborne)

    Thanks for getting in touch @svfjk, and for sharing a detailed description of what you’re encountering. Based on everything working in your development environment, please share the following and we can hopefully determine what’s happening:

    1. Your Site Health information. You can use this form to share privately if preferred.  
    2. Do you migrate the site from development to production while Site Kit was connected? I ask as some of the site records may still be referring to your development site on the Site Kit service. If so, even resetting on production won’t reset the records if they’re trying to communicate with a site records from a different domain.
    3. Have you tried resetting Site Kit on development, before then pushing to production and setting up the plugin from there.

    Let me know if you have any questions with the above. Feel free to share your development site URL when sharing your Site Health above. Thank you.

    Thread Starter svfjk

    (@svfjk)

    Hi James,

    Thank you for the quick response.

    1. I have sent the site health info via the form. Note that I have exported the info with all plugins activated, since this is a production env.

    2. I did not install Site Kit on dev before migration to production. So I have activated and setup Site Kit independently on dev and prod with no prior Site Kit data in the database.

    3. I haven’t done that, since I have activated and setup Site Kit independently on dev and prod. I have even removed all Site Kit related data from the database, like saved tokens and credential hashes before trying to reactivating/reinstalling it on prod.

    My dev environment is not available publicly, so I’m afraid I can not share that.

    Thank you.

    Plugin Support James Osborne

    (@jamesosborne)

    Thanks for the update @svfjk. From the checks I’ve been performing on your site, I can access any public REST endpoints. This may be an indication of something, possibly at host level blocking requests. Given you already attempted set up with only Site Kit active via the Health Check & Troubleshooting plugin, please share the following:

    1. Do you see any Site Kit related errors when checking the Log HTTP Requests plugin which you have active? Feel free to share these via the same form previously used if preferred.
    2. Can you confirm no issues setting up Site Kit when using this disposable WordPress site?
    3. Do you have any other WordPress sites on the same production server with which you can attempt Site Kit set up from? This could be a new WordPress install within a subdirectory, which uses the same resources. You can uninstall this after checking.

    Let me know if you have any questions with the above.

    Thread Starter svfjk

    (@svfjk)

    Yes, the REST API is heavily restricted, due to security concerns. If you want, I can open up specific endpoints/namespaces.

    1. No errors from the HTTP request, what I can see. I can send you all of the requests, if you’d like?

    2. I can confirm no errors on the disposable. Works like a charm.

    3. I have installed Site Kit on another web/domain on the same production server, and no errors there as well.

    This site is using a roots bedrock boilerplate, it might be some issues with that. I’m going to try to another docker setup and skip the /wp/ install directory…

    Plugin Support James Osborne

    (@jamesosborne)

    Many thanks for the update. It’s possible that your Bedrock environment may be impacting Site Kit setup, although this would typically happen if Site Kit was set up previously before using Bedrock, which uses a different WordPress folder structure – resulting in different callback URLs to what may have been configured previously.

    Do you recall having set up Site Kit previously on the same domain, prior to using a Bedrock environment? If so I can request a check of your site records.

    This site is using a roots bedrock boilerplate, it might be some issues with that. I’m going to try to another docker setup and skip the /wp/ install directory…

    This would indeed be a useful check, but if it you don’t have the time, not a problem. Please first of all let me know if you did have Site Kit connected previously.

    Thread Starter svfjk

    (@svfjk)

    I can’t say 100% if Sitekit has been set up previously, but not to my knowledge. But it is a possibility.

    I tested with changing the docker infrastructure to remove the wp folder, so I’ve set up a new stack on my dev server, but with the real domain.

    Now the Sitekit setup tries to callback a URL including the wp folder:

    /wp/wp-admin/?action=googlesitekit_proxy_exchange_site_code&googlesitekit_code=sitekit-{REDACTED}&googlesitekit_site_code={REDACTED}&nonce={REDACTED}&step=verification

    Nothing in my code or database (that I’m aware) references the wp folder, so could this be an old connection? I have no object cache enabled, transients are wiped. The wp_googlesitekit_redirect_url meta in usermeta doesn’t have the wp folder. Even the API call to https://sitekit.withgoogle.com/o/oauth2/site/ sends the correct URLs without the wp folder:

        [...]"redirect_uri": "https://[REDACTED]/wp-admin/index.php?oauth2callback=1"[...]

    I’ve tried this in multiple browsers, so it isn’t some redirection cache locally.

    You mentioned requesting a check of my site records, what does that mean?

    Thanks!

    Plugin Support James Osborne

    (@jamesosborne)

    Appreciate the update @svfjk. Based on the callback URL, your mention of the old callback URL seems correct (without the /wp/ path).

    You mentioned requesting a check of my site records, what does that mean?

    I can request a review of all the records on the Site Kit service, which we use as a connection between your site and the various Google API’s. Let me know if that suits. If so, this may take a couple of days for me to get an update for you. Before doing so, just to confirm, your current environment is a Bedrock setup, meaning the below are valid:
    – Site URL: https://dj*****.se/
    – WordPress admin path: https://dj*****.se/wp/wp-admin

    If any records for your site do not match the above, we can correct them, which should allow you to proceed. Let me know if you’re happy for me to request an update. Thank you!

    Thread Starter svfjk

    (@svfjk)

    If any records for your site do not match the above, we can correct them, which should allow you to proceed. Let me know if you’re happy for me to request an update. Thank you!

    Yeah, you may remove the “wp” folder in the admin path, I have now removed that in production. It should follow default WordPress paths now.

    Thanks!

    Plugin Support James Osborne

    (@jamesosborne)

    Thanks @svfjk. I submitted a request now for updating of your records. This will take a day or two.

    Note that to update your records, I had to include a reference to your wp-admin path. I don’t see it accessible when trying to access yoursite.ie/wp-admin at present. If you do have a custom wp-admin path, or you have your WordPress files in a specific directory that’s impacting your wp-admin path, please share this (privately via this form if preferred). Without knowing your wp-admin path, the team member updating your records won’t be able to do correct the callback URL which requires this.

    Thread Starter svfjk

    (@svfjk)

    yoursite.ie/wp-admin

    This is the correct path. It is blocked from the outside world, only accessable by us internally.

    Plugin Support James Osborne

    (@jamesosborne)

    Ah that makes sense. Thank you! I’ll have an update for you within the next couple of days, at which point you should be able to successfully set up the plugin. Thank you!

    Thread Starter svfjk

    (@svfjk)

    I’ve tried to set up the plugin once more, and now it works. Thank you!

    Plugin Support James Osborne

    (@jamesosborne)

    Glad to hear it @svfjk, thanks for the update. If you run into any further errors or if you have any Site Kit related queries, be sure to get in touch.

    If you have a moment free please also consider leaving a review after testing out the dashboard and features that the plugin provides.

Viewing 13 replies - 1 through 13 (of 13 total)

The topic ‘“Missing site_id or site_code” during setup’ is closed to new replies.