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

Fix 'unable to decode output into JSON' #2

Open
zipymonkey opened this issue Nov 26, 2024 · 1 comment
Open

Fix 'unable to decode output into JSON' #2

zipymonkey opened this issue Nov 26, 2024 · 1 comment
Assignees
Labels
help wanted Extra attention is needed

Comments

@zipymonkey
Copy link
Collaborator

This appears to happen when the logger is enabled and a module is installed.

  ================
   -------------- ----------- --------------- ----------------------------------------------------------
    Module         Update ID   Type            Description
   -------------- ----------- --------------- ----------------------------------------------------------
    psu_policies   10001       hook_update_n   10001 - Ensure that links to document media are working.
   -------------- ----------- --------------- ----------------------------------------------------------

   // Do you wish to run the specified pending updates?: yes.

  Error Output:
  ================
  >  [notice] Update started: psu_policies_update_10001
  >  [notice] Update completed: psu_policies_update_10001

  In ProcessBase.php line 171:

    Unable to decode output into JSON: Syntax error

    {"app": "drupal", "severity": "Info", "type": "system", "date": "2024-11-26T09:08:05", "message": "media_entity_download module installed.",  "uid": "0",  "request-uri": "https://policy-web.psul.loca
  lh
    ost/", "refer": "", "ip":  "127.0.0.1",  "link": ""}
    {
        "0": {
            "psu_policies": {
                "10001": {
                    "results": {
                        "query": null,
                        "success": true
                    },
                    "type": "update"
                }
            }
        },
        "drush_batch_process_finished": true
    }
@zipymonkey zipymonkey self-assigned this Dec 16, 2024
@zipymonkey
Copy link
Collaborator Author

zipymonkey commented Dec 16, 2024

The issue appears to be with:

 {
      "0": {
          "psul_splunk_logger": {
              "10001": {
                  "results": {
                      "query": null,
                      "success": true
                  },
                  "type": "update"
              }
          }
      },
      "drush_batch_process_finished": true
  }

This is a message thrown by the update_hooks. drush_batch_process_finished is only referenced the search_api TaskManager class... but that doesn't seem right since this appears to be causing issues without module (consolidation/site-process#56). Adding print_r to the splunk logger and the array with drush_batch_process_finished does not appear to be bing passed to the logger... so I am not 100% sure what is triggering this. We might need to revisit how data is written to Splunk and potentially not use stdout.

I tried reformatting the SplunkLogger to build the output using the JSON object but that does not seem to work:

Testing Stuff

  • Enable the `psul_splunk_logger
  • Add the following update hook to trigger the error (into psul_splunk_logger.install).
<?php

/**
 * @file
 * Installation functionality for psul_splunk_logger module.
 */

function psul_splunk_logger_update_10001() {
  // Ensure the media_entity_download module is installed.
  \Drupal::service('module_installer')->install(['admin_toolbar_search']);

}
  • Run ddev drush up to see the error.
  • Run ddev drush ev "\Drupal::service('update.update_hook_registry')->setInstalledVersion('psul_splunk_logger', 10000);"; ddev drush pm:uninstall admin_toolbar_search to reset the site.

@zipymonkey zipymonkey added the help wanted Extra attention is needed label Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant