hello , i’m using gql api on metaobject app owned and i run in a weird bug:
create a metaobject definition (app owned)
add a metaobject to the definition
delete the app
reinstall the app
recreate the definition
try to upsert the metaobject with the same handle
and i got a shopify internal error:
"Internal error. Looks like something went wrong on our end.\nRequest ID: 2578e5fc-b6a2-48aa-9e4d-f3dd3ec8eba6-1764070627 (include this in support requests)."
i queried metaobjects using storefront api and actually they are still in my shop
but they are not visible or deletable neither from gql admin api whatever token i use and neither from shopify admin panel
it’s like i create a zombie metaobject every time i uninstall and reinstall my app
Hi @emilianoc! This is a known issue our Metaobjects team is tracking internally. When you uninstall an app, Shopify deletes the metaobject definition but not the metaobject entries themselves. Those entries become orphaned - they still exist but point to a stale definition reference. When you reinstall and recreate the definition, it gets a new internal ID, but metaobjectUpsert finds the orphaned metaobject by handle and tries to update it. That update fails because the old definition reference is invalid, hence the INTERNAL_SERVER_ERROR.
Until there’s a platform fix, a workaround is to generate a unique identifier per installation and append it to your metaobject handles. Something like:
card_b3d68581 // first install
card_a7f2c9d4 // after reinstall
You could use the first few characters of a UUID or a hash of the installation timestamp. Each install operates independently with its own handles, so you avoid colliding with any orphaned metaobjects from previous installations.
There’s currently no way to clean up those orphaned metaobjects since they’re tied to the old definition, but the workaround should unblock you while the Metaobjects team works on resolving the issue. Hope this helps!