Closed florianbepunkt closed 3 months ago
I'm encountering the same issue.
This might be caused by https://shopify.dev/admin-graphql-direct-proxy/2023-10 (from the docs config) returning a 404.
The endpoint likely exists and returns a non-404 response to a POST request (although this doesn't provide information to solve the problem)
$ curl -X POST https://shopify.dev/admin-graphql-direct-proxy/2023-10
{"errors":{"query":"Required parameter missing or invalid"}}%
Additionally, the same situation occurs when changing the version to 2024-01, 2024-04, or 2024-07 (release candidate).
I can confirm the same error. I wasn't able to identify the exact reason, but it probably happened after packages update.
The current workaround I found is to use your shop's API directly: https://${STORE_DOMAIN}/admin/api/${API_VERSION}/graphql.json
instead of using https://shopify.dev/admin-graphql-direct-proxy
.
https://shopify.dev/admin-graphql-direct-proxy/2024-04 is returning a 200:
{ "errors": "Not Found" }
Here's a curl to get the same error:
curl -X POST 'https://shopify.dev/admin-graphql-direct-proxy/2024-04' \
-H 'Accept: application/graphql-response+json, application/json, multipart/mixed' \
-H 'Content-Type: application/json' \
-d '{"query":"query IntrospectionQuery {\\n __schema {\\n queryType {\\n name\\n }\\n mutationType {\\n name\\n }\\n subscriptionType {\\n name\\n }\\n types {\\n ...FullType\\n }\\n directives {\\n name\\n description\\n locations\\n args {\\n ...InputValue\\n }\\n }\\n }\\n}\\n\\nfragment FullType on __Type {\\n kind\\n name\\n description\\n fields(includeDeprecated: true) {\\n name\\n description\\n args {\\n ...InputValue\\n }\\n type {\\n ...TypeRef\\n }\\n isDeprecated\\n deprecationReason\\n }\\n inputFields {\\n ...InputValue\\n }\\n interfaces {\\n ...TypeRef\\n }\\n enumValues(includeDeprecated: true) {\\n name\\n description\\n isDeprecated\\n deprecationReason\\n }\\n possibleTypes {\\n ...TypeRef\\n }\\n}\\n\\nfragment InputValue on __InputValue {\\n name\\n description\\n type {\\n ...TypeRef\\n }\\n defaultValue\\n}\\n\\nfragment TypeRef on __Type {\\n kind\\n name\\n ofType {\\n kind\\n name\\n ofType {\\n kind\\n name\\n ofType {\\n kind\\n name\\n ofType {\\n kind\\n name\\n ofType {\\n kind\\n name\\n ofType {\\n kind\\n name\\n ofType {\\n kind\\n name\\n ofType {\\n kind\\n name\\n ofType {\\n kind\\n name\\n }\\n }\\n }\\n }\\n }\\n }\\n }\\n }\\n }\\n}"}'
Same here ! I think this's kind of critical and need fix asap
Facing the same issue with the remix app example.
Facing this issue too, please fix this Shopify.
Same here, would appreciate some 👀 and 🔧 from Shopify! 🙏
Getting same issue since Friday! Definitely needs to be addressed ASAP!
Same issue here.
Switching from @shopify/api-codegen-preset
to @shopify/hydrogen-codegen
as well as codegen.ts
instead of .graphqlrc
works for us now.
The minimal configuration we are using right now:
import { type CodegenConfig } from '@graphql-codegen/cli';
import { getSchema, pluckConfig, preset } from '@shopify/hydrogen-codegen';
const documents = ['./src/**/*.{ts,tsx}', '!node_modules'];
const outputDir = './src/client/shopify/gen';
const config: CodegenConfig = {
overwrite: true,
pluckConfig: pluckConfig as CodegenConfig['pluckConfig'],
generates: {
[`${outputDir}/storefront.generated.d.ts`]: {
preset,
schema: getSchema('storefront'),
documents,
},
[`${outputDir}/storefront.types.d.ts`]: {
schema: getSchema('storefront'),
documents,
plugins: ['typescript'],
},
},
};
export default config;
Hi @florianbepunkt, thank you for opening this issue, the team is taking a look now.
same issue here, tried different api versions and also package versions, problem persists.
It looks like this may be resolved now @matteodepalo? I'm now able to generate my types as expected.
This is still open for admin api codegen schema and types
Switching from
@shopify/api-codegen-preset
to@shopify/hydrogen-codegen
as well ascodegen.ts
instead of.graphqlrc
works for us now.The minimal configuration we are using right now:
import { type CodegenConfig } from '@graphql-codegen/cli'; import { getSchema, pluckConfig, preset } from '@shopify/hydrogen-codegen'; const documents = ['./src/**/*.{ts,tsx}', '!node_modules']; const outputDir = './src/client/shopify/gen'; const config: CodegenConfig = { overwrite: true, pluckConfig: pluckConfig as CodegenConfig['pluckConfig'], generates: { [`${outputDir}/storefront.generated.d.ts`]: { preset, schema: getSchema('storefront'), documents, }, [`${outputDir}/storefront.types.d.ts`]: { schema: getSchema('storefront'), documents, plugins: ['typescript'], }, }, }; export default config;
This wont work for admin api
Schema endpoints are back online, issue resolved.
Thank you everyone for your patience. As @skelouse pointed our we've resolved the issue. Please feel free to open a new one if you experience problems with api-codegen-preset.
Issue summary
Before opening this issue, I have:
@shopify/*
package and version: @shopify/api-codegen-preset 1.0.1{ logger: { level: LogSeverity.Debug } }
in my configuration, when applicableUsing the @shopify/api-codegen-preset throws an error during type generation:
introspectionResult.errors.map is not a function
. This might be caused by https://shopify.dev/admin-graphql-direct-proxy/2023-10 (from the docs config) returning a 404.Expected behavior
I should be able to reproduce the example from the docs: https://shopify.dev/docs/api/shopify-app-remix/v3/guide-graphql-types
Actual behavior
What actually happens?
Steps to reproduce the problem
Follow the docs https://shopify.dev/docs/api/shopify-app-remix/v3/guide-graphql-types