Problem/Motivation

Drupal throws the following error

TypeError: Drupal\graphql_compose\Plugin\GraphQLCompose\GraphQLComposeEntityTypeBase::getBundle(): Argument #1 ($bundle_id) must be of type string, int given, called in /app/web/modules/contrib/graphql_compose/src/Plugin/GraphQLCompose/FieldUnionTrait.php on line 221 in Drupal\graphql_compose\Plugin\GraphQLCompose\GraphQLComposeEntityTypeBase->getBundle() (line 189 of /app/web/modules/contrib/graphql_compose/src/Plugin/GraphQLCompose/GraphQLComposeEntityTypeBase.php).

Seems like some bundle ids are `int` not only string type.

CommentFileSizeAuthor
#2 graphql_compose-3422424.patch655 bytesabhishek_gupta1
Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

mcortes19 created an issue. See original summary.

abhishek_gupta1’s picture

Status: Active » Needs review
StatusFileSize
new655 bytes

fix the issue and created Patch. please kindly review it

mcortes19’s picture

@abhishek_gupta1 I added a MR based on your solution

almunnings’s picture

Patch looks fine, but what concerns me is how an INT is getting there n the first place.

Do you know how to reproduce it? Is it a certain field type or bundle target type?

mcortes19’s picture

@almunnings We are migrating a site from D7 with a lot of Paragraphs and when we enabled some fields the error appeared, but was hard to identify which field or fields are the cause because was most a random behavior.

Definitely I'll debug thoroughly and posted here my finding. For now this MR fixes the issue!

almunnings’s picture

I've come at it from a diff angle, I suspect the target_bundles in your data is non assoc, somehow? If thats the case, then the array keys would be ints, and that could explain the issue.

Can you please test?

https://git.drupalcode.org/project/graphql_compose/-/merge_requests/64.diff

mcortes19’s picture

@almunnings I confirm #8 works for me as well

almunnings’s picture

Status: Needs review » Fixed

In dev branch, thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.