magento2 – M2.3.3: 500 on the product creation page after adding the attribute programmatically

I am adding the product attribute programmatically as follows:

use MagentoFrameworkAppBootstrap;
require '/www/public_html/app/bootstrap.php';
$params = $_SERVER;
$bootstrap = Bootstrap::create(BP, $params);
$obj = $bootstrap->getObjectManager();

$state = $obj->get('MagentoFrameworkAppState');
$state->setAreaCode('frontend');

$eavEavSetupFactory = $obj->create('MagentoEavSetupEavSetupFactory');
$eavConfig = $obj->create('MagentoEavModelConfig');
$attributeSetFactory = $obj->create('MagentoEavModelEntityAttributeSetFactory');

/** @var ProductSetup $productSetup */
$productSetup = $eavEavSetupFactory->create();

$productEntity = $productSetup->getEntityTypeId('catalog_product');
$attributeSetId = $productSetup->getDefaultAttributeSetId($productEntity);

/** @var $attributeSet AttributeSet */
$attributeSet = $attributeSetFactory->create();
$attributeGroupId = $attributeSet->getDefaultGroupId($attributeSetId);

$productSetup->addAttribute(
    MagentoCatalogModelProduct::ENTITY,
    'custom_text_field',
    (
        'type' => 'text',
        'backend' => '',
        'frontend' => '',
        'label' => 'test_attribute',
        'input' => 'swatch_text',
        'class' => '',
        'source' => 'MagentoEavModelEntityAttributeSourceBoolean',
        'global' => MagentoEavModelEntityAttributeScopedAttributeInterface::SCOPE_GLOBAL,
        'visible' => true,
        'required' => false,
        'user_defined' => true,
        'default' => '',
        'searchable' => false,
        'filterable' => false,
        'comparable' => false,
        'visible_on_front' => true,
        'used_in_product_listing' => false,
        'unique' => false,
        'apply_to' => ''
    )
  );

Then I want to create a configurable product from the user interface and a 500 error appears on the creation page:

2020/01/26 04:06:54 (error) 1099 # 1099: * 13639 FastCGI sent in stderr:
"PHP message: PHP Fatal error: Type of error not captured: argument 2 approved
to
Magento Framework View Element UiComponentFactory :: argumentsResolver ()
must be of the array type, given null, called
/opt/magento/public_html/vendor/magento/framework/View/Element/UiComponentFactory.php
on line 222 and defined in
/opt/magento/public_html/vendor/magento/framework/View/Element/UiComponentFactory.php:174 Stack tracking:
0 /opt/magento/public_html/vendor/magento/framework/View/Element/UiComponentFactory.php(222):
Magento Framework View Element UiComponentFactory-> argumentsResolver (& # 39; custom_text_fie … & # 39 ;,
NULL)
1 /opt/magento/public_html/vendor/magento/module-ui/Component/Form/Field.php(85):
Magento Framework View Element UiComponentFactory-> create (& # 39; custom_text_fie … & # 39 ;,
& # 39; swatch_text & # 39 ;, Array)
2 /opt/magento/public_html/vendor/magento/framework/View/Layout/Generator/UiComponent.php(164):
Magento Ui Component Form Field-> prepare ()

What field is missing that gives me this NULL value instead of matrix?

PD: I'm not using the declarative form suggested by Magento since I don't want to use patches to create new attributes, since they are created dynamically based on user input. Therefore, I am stuck in using the object manager (the only way I discovered that it still works in 2.3.3).