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

[Bug]: DataHub not working in test Env #836

Open
dpfaffenbauer opened this issue Feb 17, 2024 · 11 comments
Open

[Bug]: DataHub not working in test Env #836

dpfaffenbauer opened this issue Feb 17, 2024 · 11 comments
Assignees
Milestone

Comments

@dpfaffenbauer
Copy link
Contributor

Expected behavior

should wortk

Actual behavior

not working

Steps to reproduce

run it in test env and you see:

{
  "errors": [
    {
      "message": "Schema must contain unique named types but contains multiple types named \"document_email\" (see https://webonyx.github.io/graphql-php/type-definitions/#type-registry)."
    }
  ]
}

It comes down the following:

  • Pimcore loads bundles config automatically. So it also loads the PimcoreCoreBundle config_test.yaml
  • This config sets framework.test to true
  • This changes how Symfony builds the container
  • Thus it does not inline the EmailType service and loads it twice

I didn't really quite understand why this service is instantiated twice and why it works when its inlined. here is the GraphQlService from inlined vs not:

Not Inlined:

        $d = new \Pimcore\Bundle\DataHubBundle\GraphQL\DocumentType\DocumentType($instance, ($container->privates['Pimcore\\Bundle\\DataHubBundle\\GraphQL\\DocumentType\\PageType'] ?? $container->load('getPageTypeService')), ($container->privates['Pimcore\\Bundle\\DataHubBundle\\GraphQL\\DocumentType\\LinkType'] ?? $container->load('getLinkTypeService')), ($container->privates['Pimcore\\Bundle\\DataHubBundle\\GraphQL\\DocumentType\\EmailType'] ?? $container->load('getEmailTypeService')), ($container->privates['Pimcore\\Bundle\\DataHubBundle\\GraphQL\\DocumentType\\HardlinkType'] ?? $container->load('getHardlinkTypeService')), ($container->privates['Pimcore\\Bundle\\DataHubBundle\\GraphQL\\DocumentType\\SnippetType'] ?? $container->load('getSnippetTypeService')));
        $d->registerCustomDataType([]);
        $e = ($container->privates['Pimcore\\Bundle\\DataHubBundle\\GraphQL\\DocumentType\\DocumentElementType'] ?? $container->load('getDocumentElementTypeService'));

        $instance->setSupportedGeneralTypes([]);
        $instance->setSupportedDataObjectQueryDataTypes(['coreShopDynamicDropdown', 'coreShopRelation', 'coreShopDynamicDropdownMultiple', 'coreShopItemSelector', 'coreShopSuperBoxSelect', 'coreShopSerializedData', 'coreShopRelations', 'coreShopMoney', 'coreShopCartPriceRule', 'coreShopProductSpecificPriceRules', 'coreShopProductUnit', 'coreShopProductUnitDefinition', 'coreShopProductUnitDefinitions', 'coreShopCountry', 'coreShopState', 'coreShopAddressIdentifier', 'coreShopCountryMultiselect', 'coreShopCurrency', 'coreShopCurrencyMultiselect', 'coreShopMoneyCurrency', 'coreShopTaxRuleGroup', 'coreShopStore', 'coreShopStoreMultiselect', 'coreShopFilter', 'coreShopCarrier', 'coreShopCarrierMultiselect', 'coreShopPaymentProvider', 'coreShopProductQuantityPriceRules', 'coreShopStoreValues', 'booleanSelect', 'checkbox', 'newsletterActive', 'newsletterConfirmed', 'classificationstore', 'date', 'datetime', 'email', 'href', 'manyToOneRelation', 'fieldcollections', 'firstname', 'geobounds', 'geopolygon', 'geopoint', 'hotspotimage', 'image', 'imageGallery', 'link', 'externalImage', 'input', 'rgbaColor', 'time', 'calculatedValue', 'lastname', 'multihref', 'manyToManyRelation', 'manyToManyObjectRelation', 'reverseManyToManyObjectRelation', 'reverseObjectRelation', 'multihrefMetadata', 'advancedManyToManyRelation', 'advancedManyToManyObjectRelation', 'languagemultiselect', 'multiselect', 'countrymultiselect', 'numeric', 'quantityValue', 'inputQuantityValue', 'country', 'gender', 'language', 'select', 'slider', 'textarea', 'urlSlug', 'video', 'wysiwyg', 'table', 'structuredTable', 'block']);
        $instance->setSupportedDataObjectMutationDataTypes(['coreShopDynamicDropdown', 'coreShopRelations', 'coreShopDynamicDropdownMultiple', 'coreShopItemSelector', 'coreShopSuperBoxSelect', 'booleanSelect', 'checkbox', 'country', 'countrymultiselect', 'date', 'datetime', 'email', 'externalImage', 'fieldcollections', 'geopoint', 'firstname', 'gender', 'input', 'image', 'language', 'lastname', 'newsletterActive', 'manyToOneRelation', 'manyToManyRelation', 'manyToManyObjectRelation', 'advancedManyToManyRelation', 'advancedManyToManyObjectRelation', 'multiselect', 'newsletterConfirmed', 'numeric', 'select', 'slider', 'textarea', 'time', 'wysiwyg', 'quantityValue', 'table', 'imageGallery', 'link']);
        $instance->setSupportedDocumentElementQueryDataTypes(['areablock', 'block', 'checkbox', 'date', 'embed', 'input', 'image', 'link', 'multiselect', 'numeric', 'pdf', 'relation', 'relations', 'scheduledblock', 'select', 'table', 'textarea', 'wysiwyg', 'video']);
        $instance->setSupportedDocumentElementMutationDataTypes(['areablock', 'block', 'embed', 'image', 'input', 'multiselect', 'scheduledblock', 'select', 'wysiwyg']);
        $instance->setSupportedCsFeatureQueryDataTypes(['booleanSelect', 'calculatedValue', 'checkbox', 'country', 'countrymultiselect', 'date', 'datetime', 'input', 'inputQuantityValue', 'language', 'languagemultiselect', 'multiselect', 'numeric', 'rgbaColor', 'select', 'slider', 'textarea', 'time', 'quantityValue', 'wysiwyg']);
        $instance->registerAssetDataTypes(['asset_metadata_item' => new \Pimcore\Bundle\DataHubBundle\GraphQL\AssetType\AssetMetadataItem($instance), 'asset_input' => new \Pimcore\Bundle\DataHubBundle\GraphQL\AssetType\AssetInputType($instance), '_asset_folder' => new \Pimcore\Bundle\DataHubBundle\GraphQL\AssetType\AssetFolderType($instance), 'asset_tree' => new \Pimcore\Bundle\DataHubBundle\GraphQL\AssetType\AssetTreeType($instance)]);
        $instance->registerTranslationDataTypes([]);
        $instance->registerDataObjectDataTypes(['elementdescriptor_input' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\ElementDescriptorInputType($instance), 'geopoint_input' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\GeopointInputType($instance), 'object_tree' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\ObjectTreeType($instance), '_object_folder' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\ObjectFolderType($instance), 'object_datatype_hotspotimage' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\HotspotType($instance), 'manytoone' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\HrefType($instance), 'input_quantity_value' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\InputQuantityValueType($instance), 'quantity_value' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\QuantityValueType($instance), 'url_slug' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\UrlSlugType($instance), 'object_datatype_video' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\VideoType($instance, ($container->privates['Pimcore\\Bundle\\DataHubBundle\\GraphQL\\DataObjectType\\VideoTypeDataType'] ?? $container->load('getVideoTypeDataTypeService'))), 'object_datatype_video_data' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\VideoTypeDataType($instance), 'quantity_value_input' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\QuantityValueInputType($instance), 'link_input' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\LinkInputType($instance), 'image_input' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\InputType\ImageInputType($instance)]);
        $instance->registerDocumentDataTypes(['document' => $d, 'document_tree' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DocumentType\DocumentTreeType($instance), 'document_element' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DocumentType\DocumentElementType($instance), 'document_email' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DocumentType\EmailType($instance), 'document_hardlink' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DocumentType\HardlinkType($instance, ($container->privates['Pimcore\\Bundle\\DataHubBundle\\GraphQL\\General\\AnyDocumentTargetType'] ?? $container->load('getAnyDocumentTargetTypeService'))), 'document_link' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DocumentType\LinkType($instance), 'document_page' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DocumentType\PageType($instance, $e), 'document_snippet' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DocumentType\SnippetType($instance, $e), '_document_folder' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DocumentType\DocumentFolderType($instance), 'document_link_input' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DocumentType\DocumentLinkInputType($instance)]);
        $instance->registerClassificationStoreDataTypes(['cs_group' => new \Pimcore\Bundle\DataHubBundle\GraphQL\ClassificationstoreType\Group($instance, ($container->privates['Pimcore\\Bundle\\DataHubBundle\\GraphQL\\ClassificationstoreType\\Feature'] ?? $container->load('getFeatureService'))), 'cs_feature' => new \Pimcore\Bundle\DataHubBundle\GraphQL\ClassificationstoreType\Feature($instance)]);
        $instance->registerPropertyDataTypes(['elementproperty' => new \Pimcore\Bundle\DataHubBundle\GraphQL\PropertyType\ElementPropertyType($instance), 'hotspotmetadata' => new \Pimcore\Bundle\DataHubBundle\GraphQL\PropertyType\HotspotMetadataType($instance), 'property_asset' => new \Pimcore\Bundle\DataHubBundle\GraphQL\PropertyType\AssetType($instance), 'property_document' => new \Pimcore\Bundle\DataHubBundle\GraphQL\PropertyType\DocumentType($instance), 'property_assetfolder' => new \Pimcore\Bundle\DataHubBundle\GraphQL\PropertyType\AssetFolderType($instance), 'property_documentfolder' => new \Pimcore\Bundle\DataHubBundle\GraphQL\PropertyType\DocumentFolderType($instance), 'property_objectfolder' => new \Pimcore\Bundle\DataHubBundle\GraphQL\PropertyType\ObjectFolderType($instance), 'property_object' => new \Pimcore\Bundle\DataHubBundle\GraphQL\PropertyType\DataObjectType($instance, ($container->privates['Pimcore\\Bundle\\DataHubBundle\\GraphQL\\PropertyType\\ObjectsType'] ?? $container->load('getObjectsTypeService'))), 'property_checkbox' => new \Pimcore\Bundle\DataHubBundle\GraphQL\PropertyType\CheckboxType($instance), 'property_textarea' => new \Pimcore\Bundle\DataHubBundle\GraphQL\PropertyType\TextareaType($instance), 'property_text' => new \Pimcore\Bundle\DataHubBundle\GraphQL\PropertyType\TextType($instance), 'property_select' => new \Pimcore\Bundle\DataHubBundle\GraphQL\PropertyType\SelectType($instance)]);

        return $instance;

Inlined

        $d = new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\VideoTypeDataType($instance);
        $e = new \Pimcore\Bundle\DataHubBundle\GraphQL\DocumentType\DocumentElementType($instance);

        $f = new \Pimcore\Bundle\DataHubBundle\GraphQL\DocumentType\PageType($instance, $e);
        $g = new \Pimcore\Bundle\DataHubBundle\GraphQL\DocumentType\LinkType($instance);
        $h = new \Pimcore\Bundle\DataHubBundle\GraphQL\DocumentType\EmailType($instance);
        $i = new \Pimcore\Bundle\DataHubBundle\GraphQL\DocumentType\HardlinkType($instance, new \Pimcore\Bundle\DataHubBundle\GraphQL\General\AnyDocumentTargetType($instance));
        $j = new \Pimcore\Bundle\DataHubBundle\GraphQL\DocumentType\SnippetType($instance, $e);

        $k = new \Pimcore\Bundle\DataHubBundle\GraphQL\DocumentType\DocumentType($instance, $f, $g, $h, $i, $j);
        $k->registerCustomDataType([]);
        $l = new \Pimcore\Bundle\DataHubBundle\GraphQL\ClassificationstoreType\Feature($instance);

        $instance->setSupportedGeneralTypes([]);
        $instance->setSupportedDataObjectQueryDataTypes(['coreShopDynamicDropdown', 'coreShopRelation', 'coreShopDynamicDropdownMultiple', 'coreShopItemSelector', 'coreShopSuperBoxSelect', 'coreShopSerializedData', 'coreShopRelations', 'coreShopMoney', 'coreShopCartPriceRule', 'coreShopProductSpecificPriceRules', 'coreShopProductUnit', 'coreShopProductUnitDefinition', 'coreShopProductUnitDefinitions', 'coreShopCountry', 'coreShopState', 'coreShopAddressIdentifier', 'coreShopCountryMultiselect', 'coreShopCurrency', 'coreShopCurrencyMultiselect', 'coreShopMoneyCurrency', 'coreShopTaxRuleGroup', 'coreShopStore', 'coreShopStoreMultiselect', 'coreShopFilter', 'coreShopCarrier', 'coreShopCarrierMultiselect', 'coreShopPaymentProvider', 'coreShopProductQuantityPriceRules', 'coreShopStoreValues', 'booleanSelect', 'checkbox', 'newsletterActive', 'newsletterConfirmed', 'classificationstore', 'date', 'datetime', 'email', 'href', 'manyToOneRelation', 'fieldcollections', 'firstname', 'geobounds', 'geopolygon', 'geopoint', 'hotspotimage', 'image', 'imageGallery', 'link', 'externalImage', 'input', 'rgbaColor', 'time', 'calculatedValue', 'lastname', 'multihref', 'manyToManyRelation', 'manyToManyObjectRelation', 'reverseManyToManyObjectRelation', 'reverseObjectRelation', 'multihrefMetadata', 'advancedManyToManyRelation', 'advancedManyToManyObjectRelation', 'languagemultiselect', 'multiselect', 'countrymultiselect', 'numeric', 'quantityValue', 'inputQuantityValue', 'country', 'gender', 'language', 'select', 'slider', 'textarea', 'urlSlug', 'video', 'wysiwyg', 'table', 'structuredTable', 'block']);
        $instance->setSupportedDataObjectMutationDataTypes(['coreShopDynamicDropdown', 'coreShopRelations', 'coreShopDynamicDropdownMultiple', 'coreShopItemSelector', 'coreShopSuperBoxSelect', 'booleanSelect', 'checkbox', 'country', 'countrymultiselect', 'date', 'datetime', 'email', 'externalImage', 'fieldcollections', 'geopoint', 'firstname', 'gender', 'input', 'image', 'language', 'lastname', 'newsletterActive', 'manyToOneRelation', 'manyToManyRelation', 'manyToManyObjectRelation', 'advancedManyToManyRelation', 'advancedManyToManyObjectRelation', 'multiselect', 'newsletterConfirmed', 'numeric', 'select', 'slider', 'textarea', 'time', 'wysiwyg', 'quantityValue', 'table', 'imageGallery', 'link']);
        $instance->setSupportedDocumentElementQueryDataTypes(['areablock', 'block', 'checkbox', 'date', 'embed', 'input', 'image', 'link', 'multiselect', 'numeric', 'pdf', 'relation', 'relations', 'scheduledblock', 'select', 'table', 'textarea', 'wysiwyg', 'video']);
        $instance->setSupportedDocumentElementMutationDataTypes(['areablock', 'block', 'embed', 'image', 'input', 'multiselect', 'scheduledblock', 'select', 'wysiwyg']);
        $instance->setSupportedCsFeatureQueryDataTypes(['booleanSelect', 'calculatedValue', 'checkbox', 'country', 'countrymultiselect', 'date', 'datetime', 'input', 'inputQuantityValue', 'language', 'languagemultiselect', 'multiselect', 'numeric', 'rgbaColor', 'select', 'slider', 'textarea', 'time', 'quantityValue', 'wysiwyg']);
        $instance->registerAssetDataTypes(['asset_metadata_item' => new \Pimcore\Bundle\DataHubBundle\GraphQL\AssetType\AssetMetadataItem($instance), 'asset_input' => new \Pimcore\Bundle\DataHubBundle\GraphQL\AssetType\AssetInputType($instance), '_asset_folder' => new \Pimcore\Bundle\DataHubBundle\GraphQL\AssetType\AssetFolderType($instance), 'asset_tree' => new \Pimcore\Bundle\DataHubBundle\GraphQL\AssetType\AssetTreeType($instance)]);
        $instance->registerTranslationDataTypes([]);
        $instance->registerDataObjectDataTypes(['elementdescriptor_input' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\ElementDescriptorInputType($instance), 'geopoint_input' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\GeopointInputType($instance), 'object_tree' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\ObjectTreeType($instance), '_object_folder' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\ObjectFolderType($instance), 'object_datatype_hotspotimage' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\HotspotType($instance), 'manytoone' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\HrefType($instance), 'input_quantity_value' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\InputQuantityValueType($instance), 'quantity_value' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\QuantityValueType($instance), 'url_slug' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\UrlSlugType($instance), 'object_datatype_video' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\VideoType($instance, $d), 'object_datatype_video_data' => $d, 'quantity_value_input' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\QuantityValueInputType($instance), 'link_input' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\LinkInputType($instance), 'image_input' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DataObjectType\InputType\ImageInputType($instance)]);
        $instance->registerDocumentDataTypes(['document' => $k, 'document_tree' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DocumentType\DocumentTreeType($instance), 'document_element' => $e, 'document_email' => $h, 'document_hardlink' => $i, 'document_link' => $g, 'document_page' => $f, 'document_snippet' => $j, '_document_folder' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DocumentType\DocumentFolderType($instance), 'document_link_input' => new \Pimcore\Bundle\DataHubBundle\GraphQL\DocumentType\DocumentLinkInputType($instance)]);
        $instance->registerClassificationStoreDataTypes(['cs_group' => new \Pimcore\Bundle\DataHubBundle\GraphQL\ClassificationstoreType\Group($instance, $l), 'cs_feature' => $l]);
        $instance->registerPropertyDataTypes(['elementproperty' => new \Pimcore\Bundle\DataHubBundle\GraphQL\PropertyType\ElementPropertyType($instance), 'hotspotmetadata' => new \Pimcore\Bundle\DataHubBundle\GraphQL\PropertyType\HotspotMetadataType($instance), 'property_asset' => new \Pimcore\Bundle\DataHubBundle\GraphQL\PropertyType\AssetType($instance), 'property_document' => new \Pimcore\Bundle\DataHubBundle\GraphQL\PropertyType\DocumentType($instance), 'property_assetfolder' => new \Pimcore\Bundle\DataHubBundle\GraphQL\PropertyType\AssetFolderType($instance), 'property_documentfolder' => new \Pimcore\Bundle\DataHubBundle\GraphQL\PropertyType\DocumentFolderType($instance), 'property_objectfolder' => new \Pimcore\Bundle\DataHubBundle\GraphQL\PropertyType\ObjectFolderType($instance), 'property_object' => new \Pimcore\Bundle\DataHubBundle\GraphQL\PropertyType\DataObjectType($instance, new \Pimcore\Bundle\DataHubBundle\GraphQL\PropertyType\ObjectsType($instance)), 'property_checkbox' => new \Pimcore\Bundle\DataHubBundle\GraphQL\PropertyType\CheckboxType($instance), 'property_textarea' => new \Pimcore\Bundle\DataHubBundle\GraphQL\PropertyType\TextareaType($instance), 'property_text' => new \Pimcore\Bundle\DataHubBundle\GraphQL\PropertyType\TextType($instance), 'property_select' => new \Pimcore\Bundle\DataHubBundle\GraphQL\PropertyType\SelectType($instance)]);

        $c->setGraphQlService($instance);

        $b->setGraphQlService($instance);

        $a->setGraphQlService($instance);

        return $instance;

You can see that the EmailType get's instantiated twice, in both cases. But I did not understand why one works and the other doesn't. Anyhow: That service should always only get instantiated once anyway. So there is an issue with the service declaration somewhere.

@ibousfiha
Copy link

Thank you for reporting this.
Can you please provide more details on how to reproduce?
Are you running a specific test or a query?

@dpfaffenbauer
Copy link
Contributor Author

Run in test env and try to execute any query.

@ibousfiha
Copy link

Unfortunately I couldn't reproduce, it would be helpful if you could provide more insights.

@dpfaffenbauer
Copy link
Contributor Author

what happens if you enable this for you:

framework:
    test: false

@dpfaffenbauer
Copy link
Contributor Author

dpfaffenbauer commented Feb 20, 2024

I've just checked again, it doesn't do that for an out-of-the box setup.

We added our own datahub provider that extends the graphql one. Basically allowing us to add custom configs and modify the query set. It only happens when you do that.

If you are interested, I can give you access to the repo. It's private.

@dpfaffenbauer
Copy link
Contributor Author

not true, after further investigation, it also happens without my bundle when using a graphql config with documents enabled and framework.test enabled.

this config fails for me:

pimcore_data_hub:
    configurations:
        test:
            general:
                active: true
                type: graphql
                name: test
                description: ''
                group: ''
                sqlObjectCondition: ''
                modificationDate: 1708453670
                path: null
                createDate: 1708453186
            schema:
                queryEntities: { }
                mutationEntities: {  }
                specialEntities:
                    document:
                        read: true
                        create: false
                        update: false
                        delete: false
                    document_folder:
                        read: false
                        create: false
                        update: false
                        delete: false
                    asset:
                        read: true
                        create: false
                        update: false
                        delete: false
                    asset_folder:
                        read: false
                        create: false
                        update: false
                        delete: false
                    asset_listing:
                        read: false
                        create: false
                        update: false
                        delete: false
                    object_folder:
                        read: false
                        create: false
                        update: false
                        delete: false
                    translation:
                        read: false
                        create: false
                        update: false
                        delete: false
                    translation_listing:
                        read: false
                        create: false
                        update: false
                        delete: false
                    coreshop_frontend:
                        read: true
                        create: false
                        update: false
                        delete: false
            security:
                method: datahub_apikey
                apikey:
                    - f3025c050b6e7934c33a737a2ab5069d
                skipPermissionCheck: false
                disableIntrospection: false
            workspaces:
                asset: {  }
                document: {  }
                object:
                    -
                        read: true
                        cpath: /
                        create: false
                        update: false
                        delete: false
                        id: extModel1438-1
            permissions:
                user: {  }
                role: {  }

@kingjia90
Copy link
Contributor

Thank you, could reproduce it
(beside that the workspace rule here should be assigned document instead of object
image)

and dug a little bit but don't know how to fix it, it seems that when framework.test is set, it tries to get service instantiated each time (for testing purposes i guess, more practical with mock services?)

@dpfaffenbauer
Copy link
Contributor Author

@kingjia90 Its a test setup, so config might be messed up due to testing ;)

I also don't know what is going on... But whatever it is, it should be fixed. It makes it quite uncomfortable to test with data-hub with these weird issues.

@fashxp
Copy link
Member

fashxp commented Feb 21, 2024

Did that emerge recently, or has it always been that way?
Maybe related? pimcore/pimcore#16582

@dpfaffenbauer
Copy link
Contributor Author

no idea

@dkarlovi
Copy link

I was just about to report this issue for object_folder.

We had this issue before, it's due to the fact the type map is kept around between (test) requests, but the type objects are created again and again, I'm not sure exactly why that is.

We've workaround it by doing something like this

private static ?InputObjectType $type = null;

public function getGraphQlMutationOperatorConfig($nodeDef, $class = null, $container = null, $params = []): array
{
        return [
            'arg' => ['type' => Type::listOf(self::$type ??= new InputObjectType([
            // etc...

Since the instance of the type is kept around somewhere and then the type map is checked for name and instance in \GraphQL\Utils\TypeInfo::extractTypes, this basically keeps the same type around instead of creating a new instance (which will not pass the check).

We had this issue even with regular use, not just in tests, if the same operator was assigned multiple times.

@Corepex Corepex modified the milestones: 1.6.6, 1.7.1 Mar 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants