next-drupal icon indicating copy to clipboard operation
next-drupal copied to clipboard

Can't apply required patches on Drupal 9/ PHP 8/Alpine installation.

Open laurencefass opened this issue 3 years ago • 4 comments

Problem:

Node preview displays an error. It was suggested here that this may be due to the required patches not being installed, but I cannot install them to a Drupal9 PHP8 environment, and the patches are not verified as tested on PHP 8.

Node preview results in:

Server Error
Error: The path attribute is missing for entity with slug /blog/future-drupal-headless

This error happened while generating the page. Any console logs will be displayed in the terminal window.
Source
(api)/pages/api/preview.tsx (9:9) @ async handler

   7 |   response: NextApiResponse
   8 | ) {
>  9 |   return await drupal.preview(request, response)
     |         ^
  10 | }
  11 | 

I am unable to install the required patches on my Drupal 9 installation as I am using PHP 8 which is the recommended minumum requirement for Drupal 9.

bash-5.1# php -v
PHP 8.1.3 (cli) (built: Feb 18 2022 20:33:47) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.1.3, Copyright (c) Zend Technologies
    with Zend OPcache v8.1.3, Copyright (c), by Zend Technologies

The required patches are compatible/tested with Drupal 7. I cant guarantee that this is the problem I am seeing, but neither of them supported PHP 8, and by inference, Drupal 9.

The patches: 63049395-09.patch: https://www.drupal.org/pift-ci-job/1352019 3111456-34.patch: https://www.drupal.org/pift-ci-job/2052225

The result of trying to apply patches:

bash-5.1# composer install (or composer require cweagans/composer-patches)

Gathering patches for root package.
Removing package drupal/decoupled_router so that it can be re-installed and re-patched.
  - Removing drupal/decoupled_router (2.0.3)
Removing package drupal/subrequests so that it can be re-installed and re-patched.
  - Removing drupal/subrequests (3.0.3)
Deleting web/modules/contrib/decoupled_router - deleted
Deleting web/modules/contrib/subrequests - deleted
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Package operations: 2 installs, 0 updates, 0 removals
Gathering patches for root package.
Gathering patches for dependencies. This might take a minute.
  - Installing drupal/subrequests (3.0.3): Extracting archive
  - Installing drupal/decoupled_router (2.0.3): Extracting archive
  - Applying patches for drupal/subrequests
    https://www.drupal.org/files/issues/2019-07-18/change_request_type-63049395-09.patch (Get same results on different request)
   Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/2019-07-18/change_request_type-63049395-09.patch

  - Applying patches for drupal/decoupled_router
    https://www.drupal.org/files/issues/2021-05-05/3111456-34.patch (Unable to resolve path on node in other language than default)
   Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/2021-05-05/3111456-34.patch

laurencefass avatar Jun 03 '22 09:06 laurencefass

update:

After installing dev versions of both modules, the drupal/subrequests patch installed and I can now see the preview version, but this is depedent upon using the dev version of the module, and is therefore not stable.

The decoupled_router patch still doesnt apply even using the dev version

bash-5.1# composer install
Gathering patches for root package.
Removing package drupal/decoupled_router so that it can be re-installed and re-patched.
  - Removing drupal/decoupled_router (dev-2.x 4fd3ab2)
Removing package drupal/subrequests so that it can be re-installed and re-patched.
  - Removing drupal/subrequests (dev-3.x e370675)
Deleting web/modules/contrib/decoupled_router - deleted
Deleting web/modules/contrib/subrequests - deleted
Installing dependencies from lock file (including require-dev)
Verifying lock file contents can be installed on current platform.
Warning: The lock file is not up to date with the latest changes in composer.json. You may be getting outdated dependencies. It is recommended that you run `composer update` or `composer update <package name>`.
Package operations: 2 installs, 0 updates, 0 removals
  - Syncing drupal/subrequests (dev-3.x e370675) into cache
  - Syncing drupal/decoupled_router (dev-2.x 4fd3ab2) into cache
Gathering patches for root package.
Gathering patches for dependencies. This might take a minute.
  - Installing drupal/subrequests (dev-3.x e370675): Cloning e370675edf from cache
  - Installing drupal/decoupled_router (dev-2.x 4fd3ab2): Cloning 4fd3ab27bb from cache
  - Applying patches for drupal/subrequests
    https://www.drupal.org/files/issues/2019-07-18/change_request_type-63049395-09.patch (Get same results on different request)

  - Applying patches for drupal/decoupled_router
    https://www.drupal.org/files/issues/2021-05-05/3111456-34.patch (Unable to resolve path on node in other language than default)
   Could not apply patch! Skipping. The error was: Cannot apply patch https://www.drupal.org/files/issues/2021-05-05/3111456-34.patch
...

laurencefass avatar Jun 03 '22 09:06 laurencefass

I've raised a drupal issue to make module maintainers aware of potential incompatibility.

https://www.drupal.org/project/decoupled_router/issues/3283966

laurencefass avatar Jun 03 '22 09:06 laurencefass

@laurencefass Thanks for reporting back. I'll look into it and see if the patch is obsolete and if we need a new one.

shadcn avatar Jun 03 '22 14:06 shadcn

Hi, Experienced the same issue on windows 10, Added the patch.exe ("C:\Program Files\Git\usr\bin") on the windows environment variable, and it works.

suresh-kumar-ogilvy avatar Jul 07 '22 12:07 suresh-kumar-ogilvy