Service ID overridden

Created on 12 December 2022, about 2 years ago
Updated 23 February 2023, almost 2 years ago

Problem/Motivation

Sometimes it seems that the service ID might change in the remote. In this case doing a deployment might revert the service ID back to the original value and break the connection.

Steps to reproduce

Not sure when service ID might change in the remote.

Proposed resolution

Should some configuration be ignored? Using config_ignore possibly?

🐛 Bug report
Status

Active

Version

2.1

Component

Code

Created by

🇫🇮Finland merilainen

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • 🇫🇮Finland merilainen

    This looks better now. Maybe it's a bit drastic change to move everything to Drupal state, because the only thing which might change in the remote is the service_id and services values. Now all other configuration needs to be added manually to each environment.

  • 🇫🇮Finland merilainen

    Now the module seems to give an error when saving a provider:

    The website encountered an unexpected error. Please try again later.
    TypeError: in_array(): Argument #2 ($haystack) must be of type array, null given in in_array() (line 163 of modules/contrib/tmgmt_ilangl/src/ILangLTranslatorUi.php).
    

    And the data looks like this:

    in_array('ilangl', NULL) (Line: 163)
    Drupal\tmgmt_ilangl\ILangLTranslatorUi->validateConfigurationForm(Array, Object) (Line: 237)
    Drupal\tmgmt\Form\TranslatorForm->validateForm(Array, Object)
    

    Seems that the values are saved to the Drupal state and it's possible to select the provider which the form fetches, so translations still work correctly.

  • I noticed the issue with saving after updating the module. Problem is, on the file ILangTranslatorUi.php it tries to fetch the providers with this:

    $providers = $ilanglTranslator->getState('providers');

    Then if the provider you are trying to save is not there, it tries to save it. The problem is, for saving the provider, it makes sure the provider is not already in that providers array, but $providers returns undefined when empty so the function crashes and the provider never gets saved in the state since the function crashes before. I made a small validation and seems to solve the saving issue.

Production build 0.71.5 2024