-
Notifications
You must be signed in to change notification settings - Fork 196
Open
Description
GraphQL Codegen Validation Error for translatableResource
Issue summary
Before opening this issue, I have:
- Upgraded to the latest version of the relevant packages
@shopify/api-codegen-preset:^1.2.1@shopify/hydrogen-codegen:^0.3.3- Node version:
v24.9.0(npmv11.6.0) - Operating system:
macOS
- Set
{ logger: { level: LogSeverity.Debug } }in my configuration, when applicable - Found a reliable way to reproduce the problem that indicates it's a problem with the package
- Looked for similar issues in this repository
- Checked that this isn't an issue with a Shopify API
The query itself works in the Admin API, so this appears to be a codegen/schema issue.
Short description
The GraphQL query translatableResource is valid in the Shopify Admin API, but running @shopify/hydrogen-codegen or @shopify/api-codegen-preset fails with a validation error indicating the field does not exist on QueryRoot.
Expected behavior
The codegen should successfully validate the query and generate the corresponding TypeScript types, since translatableResource is a valid Admin API field.
Actual behavior
Running codegen produces:
Steps to reproduce the problem
- Create a file
app/admin/queries.tswith the following query:
export const COLLECTION_TRANSLATION_BY_LOCALE_AND_MARKET = `#graphql
query CollectionHandleTranslationsByLocaleAndMarket(
$collectionId: ID!
$locale: String!
$marketId: ID
) {
translatableResource(resourceId: $collectionId) {
resourceId
translations(locale: $locale, marketId: $marketId) {
key
locale
value
}
}
}
` as const;- Run @shopify/hydrogen-codegen (or @shopify/api-codegen-preset) on this file.
- Observe the validation error above.
Configuration
import type {CodegenConfig} from '@graphql-codegen/cli';
import {pluckConfig, preset, getSchema} from '@shopify/hydrogen-codegen';
import {ApiType, shopifyApiProject} from '@shopify/api-codegen-preset';
export default {
overwrite: true,
pluckConfig,
generates: {
'storefrontapi.generated.d.ts': {
preset,
schema: getSchema('storefront'),
documents: ['./app/storefront/**/*.{ts,tsx,js,jsx}'],
},
'admin.generated.d.ts': shopifyApiProject({
apiType: ApiType.Admin,
apiVersion: '2025-10',
documents: ['./app/admin/**/*.{ts,tsx,js,jsx}'],
}),
},
} as CodegenConfig;Debug logs
[Codegen] GraphQL Document Validation failed with 1 errors;
Error 0: Cannot query field "translatableResource" on type "QueryRoot".
at app/admin/queries.ts:7:5
Metadata
Metadata
Assignees
Labels
No labels