Ljubljana
Account created on 25 August 2017, almost 7 years ago
#

Merge Requests

More

Recent comments

🇸🇮Slovenia useernamee Ljubljana

#122 patch did not fix the issue for our page that's hosted on aws and we're getting 403 from the server. To make it harder to debug, the media library pagination works locally and on our CI.

I was thinking about writing an http_middleware that is checking the request size and creates a watchdog warning if request is to big. Then at least we'd know we're going to have problems on production environments.

This is how our request looks like:

GET /views/ajax?media_library_opener_id=media_library.opener.editor&media_library_allowed_types%5B0%5D=image&media_library_allowed_types%5Bdocument%5D=document&media_library_allowed_types%5Bgallery%5D=gallery&media_library_allowed_types%5Bvideo%5D=video&media_library_selected_type=image&media_library_remaining=1&media_library_opener_parameters%5Bfilter_format_id%5D=restricted_html&media_library_opener_parameters%5Btenant%5D=<id>&media_library_view=media_library&media_library_display=widget_table&hash=<hash>&_wrapper_format=drupal_modal&_wrapper_format=drupal_ajax&view_name=media_library&view_display_id=widget_table&view_args=image&view_path=%2Fmedia-library&view_base_path=admin%2Fcontent%2Fmedia-widget-table&view_dom_id=d9cf4f37403929685b2da3338f20b4af842d6a45f430e626c1acfaa79e4abc69&pager_element=0&media_library_opener_id=media_library.opener.editor&media_library_allowed_types%5B0%5D=image&media_library_allowed_types%5Bdocument%5D=document&media_library_allowed_types%5Bgallery%5D=gallery&media_library_allowed_types%5Bvideo%5D=video&media_library_selected_type=image&media_library_remaining=1&media_library_opener_parameters%5Bfilter_format_id%5D=restricted_html&media_library_opener_parameters%5Btenant%5D=<id>&media_library_view=media_library&media_library_display=widget_table&hash=<hash>&_wrapper_format=drupal_modal&page=1&_drupal_ajax=1&ajax_page_state%5Btheme%5D=<theme>&ajax_page_state%5Btheme_token%5D=<token>Q&ajax_page_state%5Blibraries%5D=<924chars-of-hash> HTTP/2
Host: cms.int.infoportal.cloud.wholesaleservices.de
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/115.0
Accept: application/json, text/javascript, */*; q=0.01
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate, br
Referer: https://<domain>/node/add/article/<id>
X-Requested-With: XMLHttpRequest
Connection: keep-alive
Cookie: SSES<session-cookie> AWS<220-chars of was cookies>
Sec-Fetch-Dest: empty
Sec-Fetch-Mode: cors
Sec-Fetch-Site: same-origin
DNT: 1
Sec-GPC: 1
TE: trailers

and response is pretty simple:

HTTP/2 403 Forbidden
server: awselb/2.0
date: Thu, 20 Jun 2024 10:52:57 GMT
content-type: text/html
content-length: 118
X-Firefox-Spdy: h2
🇸🇮Slovenia useernamee Ljubljana

For me the patch # 27 🐛 Ajax Pager broken after upgrade 10.0.9 to 10.1.2 Needs work breaks some other views (because view_name parameter is not found).

But the underlying problem, why I'm looking into this issue is because aws is returning 403 on /views/ajax requests because url query is too long, so I'm looking into ways how to compress the query params length.

🇸🇮Slovenia useernamee Ljubljana

merged.

will be part of release 2.0.2.

🇸🇮Slovenia useernamee Ljubljana

merged

creating a new release - 2.0.2

🇸🇮Slovenia useernamee Ljubljana

During working on this ticket I noticed that drupal cache gets permanent status if expires header is not set, that's why added that one as well.

🇸🇮Slovenia useernamee Ljubljana

useernamee created an issue.

🇸🇮Slovenia useernamee Ljubljana

We're using patch #11 and it fixes our issue.

🇸🇮Slovenia useernamee Ljubljana

We are using the patch from #4 and it fixes our issue. Thus moving it into RTBC.

🇸🇮Slovenia useernamee Ljubljana

Patch #6 fixes our issue.

Once tests are added I'd recommend moving this ticket into RTBC.

🇸🇮Slovenia useernamee Ljubljana

I'm seeing this error:

The website encountered an unexpected error. Try again later.

TypeError: Drupal\ohdear_integration\Controller\OhDearIntegrationController::refineCacheMetadata(): Argument #1 ($cacheable_dependency) must be of type Drupal\ohdear_integration\Controller\RefinableCacheableDependencyInterface, Drupal\Core\Access\AccessResultAllowed given, called in /app/web/modules/contrib/ohdear_integration/src/Controller/OhDearIntegrationController.php on line 202 in Drupal\ohdear_integration\Controller\OhDearIntegrationController->refineCacheMetadata() (line 212 of modules/contrib/ohdear_integration/src/Controller/OhDearIntegrationController.php).

Drupal\ohdear_integration\Controller\OhDearIntegrationController->access(Object) (Line: 108)
Drupal\ohdear_integration\Controller\OhDearIntegrationController->Drupal\ohdear_integration\Controller\{closure}() (Line: 627)
Drupal\Core\Render\Renderer->executeInRenderContext(Object, Object) (Line: 136)
Drupal\ohdear_integration\Controller\OhDearIntegrationController->buildJson()
🇸🇮Slovenia useernamee Ljubljana

If you have http_cache_control module installed, you need this patch: 🐛 Allow s-maxage to be overridden RTBC

🇸🇮Slovenia useernamee Ljubljana

I found this patch and it is exactly what we were looking for. RTBC.

🇸🇮Slovenia useernamee Ljubljana

I've created a MR on 📌 Improve debugging/developer experience with rest_log module Needs review and tested the issue locally. It worked well. I did also create a MR.

I did not really need the currentRouteMatch in check in our log check (https://git.drupalcode.org/project/lupus_decoupled/-/merge_requests/83/d...) but I don't really see it as an issue.

🇸🇮Slovenia useernamee Ljubljana

I added the rest log in require-dev and suggest in composer.json.

For checking api requests I've added a request check:

  protected function isApiResponse(Request $request): bool {
    return $request->attributes->get('lupus_ce_renderer') || $request->getRequestFormat() == 'custom_elements';
  }

I've also been considering some other ways, but this seemed the most straightforward. The module now works just on on/off - if enabled it logs and if not it doesn't. I think that for development experience this is enough.

🇸🇮Slovenia useernamee Ljubljana

Thank you @ad0z for improvements, I checked PR and it looks good to me. I've created a Lupus Decoupled Drupal issue to implement it 📌 Improve debugging/developer experience with rest_log module Needs review . I'll move this ticket into RTBC after I test it with Lupus Decoupled Drupal.

🇸🇮Slovenia useernamee Ljubljana

There is also an issue when visiting /admin/reports/ohdear/info. The site breaks if api key is wrong or missing. Controller probably needs some error handling or the ohdear service.

🇸🇮Slovenia useernamee Ljubljana

Unfortunately the patch does not work for me. If I try to edit the fields of specific content/bundle, after saving the form all the fields are hidden and if I check and uncheck the bundle all the fields checked once again.

Anyways I think that the data is correct even though once the form reloads you can't see which fields are (un)checked. I did de-select some paragraphs fields, saved the form and then checked the values that were visually hidden and the fields were (un)checked correctly as I set them.

I guess it is inconvenient not to be able to see the field settings but the configuration is saved correctly.

🇸🇮Slovenia useernamee Ljubljana

I propose to add voter design pattern to determine whether to log an request or not.

🇸🇮Slovenia useernamee Ljubljana

It was tested by Martin.

🇸🇮Slovenia useernamee Ljubljana

Code changes looks good. @martin is there some test envrionment to test it?

I just don't understand why you remove elements from get parameters: https://git.drupalcode.org/project/migrate_log_ui/-/merge_requests/3/dif...

🇸🇮Slovenia useernamee Ljubljana

merged & will be a part of next release

🇸🇮Slovenia useernamee Ljubljana

Code looks good. Works on our project.

🇸🇮Slovenia useernamee Ljubljana

Merged, will be a part of next release.

🇸🇮Slovenia useernamee Ljubljana

Looks good, works on our system.

🇸🇮Slovenia useernamee Ljubljana

merged, will be part of next release

🇸🇮Slovenia useernamee Ljubljana

We are using this patch on our Drupal 10 project. RTBC.

🇸🇮Slovenia useernamee Ljubljana

@jamesgrobertson changes look good to me, except for the missing changes in the DeleteLogGroupForm which I plan to add manually.

@aludescher would you agree that we add this small change to your patch:

diff -u b/src/Logger/Log.php b/src/Logger/Log.php
--- b/src/Logger/Log.php
+++ b/src/Logger/Log.php
@@ -179,7 +183,16 @@
    $this->putLog->putLog(
      $aws_client,
-      $message_formatted,
+     $event->getMessage(),
      $event->getLogGroup(),
      $event->getLogStream()
    );

This code is already running on system so I'm marking this ticket RTBC.

🇸🇮Slovenia useernamee Ljubljana

Patch applied to 8.x-1.x main branch.

🇸🇮Slovenia useernamee Ljubljana

Changes are good and we're using this patch on our system. -> RTBC

🇸🇮Slovenia useernamee Ljubljana

I guess the way forward would be to make RestLogSubscriber::isRestPage method easily extensible from outside with SOLID principles and rename it to sth like applies.

🇸🇮Slovenia useernamee Ljubljana

useernamee created an issue.

🇸🇮Slovenia useernamee Ljubljana

Reviewed and it looks good.

Thank you @casey & @roderik for you contributions.

🇸🇮Slovenia useernamee Ljubljana

Had a minor issue in the patch and I fixed that.

🇸🇮Slovenia useernamee Ljubljana

I've re-rolled the patch for 10.2.3 version

🇸🇮Slovenia useernamee Ljubljana

Well, I wouldn't mind if there'd be some kind of log message that would log if a library name is malformed such as it was the case in 🐛 Fix not loading bootstrap_styles/aos.local or bootstrap_styles/aos.remote library Fixed . It would be easier to debug such occurrences.

🇸🇮Slovenia useernamee Ljubljana

I've also created a patch so that it can be added to project composer patches.

🇸🇮Slovenia useernamee Ljubljana

I've investigated the issue a bit and found the max batch size limit on PutLogEvents.

https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API...

So I've added some logic that truncates the message to 256kb if it is too long.

🇸🇮Slovenia useernamee Ljubljana

I've added the proposed changes.

🇸🇮Slovenia useernamee Ljubljana

Patch fixes issue on our CI environment.

🇸🇮Slovenia useernamee Ljubljana

useernamee created an issue.

🇸🇮Slovenia useernamee Ljubljana

I've checked the patch.
ohdear_integration.settings service should be removed as well from services.yml file.
Then from:
- https://git.drupalcode.org/project/ohdear_integration/-/blob/2.x/src/OhD...

Otherwise the patch looks good. It just need a few more things to take care of.

🇸🇮Slovenia useernamee Ljubljana

PR looks good and it will fix phpstan errors. RTBC.

composer phpstan-check web/modules/contrib/lupus_ce_renderer
> vendor/bin/phpstan analyze --memory-limit=-1 'web/modules/contrib/lupus_ce_renderer'
Note: Using configuration file /home/len/Projects/drunomix/ldp/ldp-project/phpstan.neon.
 19/19 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%

 ------ ----------------------------------------------------------------------------------------------------------- 
  Line   src/CustomElementsMetatagsGenerator.php                                                                    
 ------ ----------------------------------------------------------------------------------------------------------- 
  56     Access to an undefined property Drupal\lupus_ce_renderer\CustomElementsMetatagsGenerator::$moduleHandler.  
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property                       
  101    Access to an undefined property Drupal\lupus_ce_renderer\CustomElementsMetatagsGenerator::$moduleHandler.  
         💡 Learn more: https://phpstan.org/blog/solving-phpstan-access-to-undefined-property                       
 ------ ----------------------------------------------------------------------------------------------------------- 
🇸🇮Slovenia useernamee Ljubljana

All points are merged/done in this ticket, fixed.

🇸🇮Slovenia useernamee Ljubljana

@casey - good point - should we add some checkbox to tell the module that the site is not online? Or maybe we should just handle missing API key differently (e.g. we could move the functionality into submodule).

Are there any good examples from other modules, how they handle similar scenarios?

🇸🇮Slovenia useernamee Ljubljana

Alternatively we could use:

if (($entity instanceof ContentEntityInterface || $entity instanceof WebformInterface) &&
        $entity->hasLinkTemplate('canonical') &&
        // Only add alternate link if entity is translated.
        count($entity->getTranslationLanguages()) > 1) {

but I don't like this solution either. getTranslationLanguages is defined on WebformInterface and the problem with this is that it is too specific for my taste. It might cause issues if webform is not installed.

ContentEntityInterface (ultimately) inherits the method from web/core/lib/Drupal/Core/TypedData/TranslatableInterface.php but that is not the case for Config entities.

🇸🇮Slovenia useernamee Ljubljana

This solution works for me, but I've just figured it out that it only adds webform translations if content_translation module is installed which is not optimal. https://git.drupalcode.org/project/lupus_ce_renderer/-/merge_requests/33...

This condition might need some more consideration.

🇸🇮Slovenia useernamee Ljubljana

I've quickly checked: https://git.drupalcode.org/project/metatag/-/blob/2.0.x/metatag.module?r... metatag_generate_entity_all_tags should be used because it also provides the alter hook and the manager does not.

Plz just drop the metatagManager service since it is not used in the class.

🇸🇮Slovenia useernamee Ljubljana

@junkuncz thank you for you PR.

I've quickly checked changed files and I've noticed that in the CustomElementsMetatagsGenerator there is MetatagManager service injected but never used. Either this should go out we use it instead of the deprecated metatag_generate_entity_metatags function.

🇸🇮Slovenia useernamee Ljubljana

Summary looks good to me and I've added it to the module description. I've also added a logo to the codebase.

Production build 0.69.0 2024