# Fetch Schema giving error when downloading the schema from server

**URL:** <https://community.apollographql.com/t/fetch-schema-giving-error-when-downloading-the-schema-from-server/7385>\
**Category:** Server\
**Tags:** server, ios\
**Created:** [April 15, 2024, 10:46am UTC](https://community.apollographql.com/t/fetch-schema-giving-error-when-downloading-the-schema-from-server/7385 "2024-04-15T10:46:46Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Mayank\_Mathur](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/mayank_mathur/32/5021_2.png) [@Mayank\_Mathur](https://community.apollographql.com/u/Mayank_Mathur)\
**Post date:** [April 15, 2024, 10:46am UTC](https://community.apollographql.com/t/fetch-schema-giving-error-when-downloading-the-schema-from-server/7385/1 "2024-04-15T10:46:46Z")

</div>

I have updated my Apollo SDK version from 0.33 to latest 1.9.3. As there is a major change in the SDK, I am facing a lot of issues. I have successfully solved some but now stuck and downloading Schema using Apollo codegen CLI.  
Problem Statements 1 - My Schema is stored at S3 server always. Using the CLI terminal I have created the `apollo-codegen-config` and now before I call `generate` command, I am trying to fetch the schema using command -

```auto
./apollo-ios-cli fetch-schema

```

But I am getting below error on:

```auto
Error: keyNotFound(GETCodingKeys(stringValue: "queryParameterName", intValue: nil), Swift.DecodingError.Context(codingPath: [CodingKeys(stringValue: "schemaDownload", intValue: nil), CodingKeys(stringValue: "downloadMethod", intValue: nil), CodingKeys(stringValue: "introspection", intValue: nil), IntrospectionCodingKeys(stringValue: "httpMethod", intValue: nil), CodingKeys(stringValue: "GET", intValue: nil)], debugDescription: "No value associated with key GETCodingKeys(stringValue: \"queryParameterName\", intValue: nil) (\"queryParameterName\").", underlyingError: nil))

```

This is my `apollo-codegen-config` file -

```auto
{
  "schemaNamespace" : "STXAPI",
  "input" : {
    "operationSearchPaths" : [
      "**/*.graphql"
    ],
    "schemaSearchPaths" : [
      "**/schema.json"
    ]
  },
  "output" : {
    "testMocks" : {
      "none" : {
      }
    },
    "schemaTypes" : {
      "path" : "./STXAPI",
      "moduleType" : {
        "swiftPackageManager" : {
        }
      }
    },
    "operations" : {
      "inSchemaModule" : {
      }
    }
  },
  "schemaDownload": {
      "downloadMethod": {
          "introspection": {
              "endpointURL": "https://s3.us-east-1.amazonaws.com/schema.stxapp.io/v2.0.74/schema.json",
              "httpMethod": {
                  "GET": {}
              },
              "includeDeprecatedInputValues": false,
              "outputFormat": "JSON"
          }
      },
      "downloadTimeout": 60,
      "headers": {
          "Allow-Introspection": "true"
      },
      "outputPath": "./graphql/schema.graphqls"
  }
}

```

What I am missing out or I need to change please help?

Problem Statement 2 - How can I do all the Schema Init and generate and fetch schema in a CI/CD pipeline, I am using Bitrise for that?

Any help is appreciated.

---

<div class="post-metadata">

**Author:** ![calvincestari](https://sea1.discourse-cdn.com/flex019/user_avatar/community.apollographql.com/calvincestari/32/339_2.png) [@calvincestari](https://community.apollographql.com/u/calvincestari)\
**Post date:** [April 15, 2024, 5:38pm UTC](https://community.apollographql.com/t/fetch-schema-giving-error-when-downloading-the-schema-from-server/7385/2 "2024-04-15T17:38:16Z")

</div>

Hi @Mayank_Mathur 👋

> Problem Statements 1 - My Schema is stored at S3 server always. Using the CLI terminal I have created the `apollo-codegen-config` and now before I call `generate` command, I am trying to fetch the schema using command

I’ll admit the `GET` schema download method isn’t very well documented but I think the larger problem is that you appear to have a static schema at that URL rather than using introspection. The `GET` http method requires a `queryParameterName` property because Apollo iOS wants to know the query name for introspection. So it’s expecting to find something like this:

```auto
"httpMethod": {
    "GET": {
        "queryParameterName": "MyIntrospectionQuery"
    }
}

```

You might be able to fudge it by just using a blank string (`""`) as the value for `queryParameterName` but Apollo iOS will still attempt to send an entire introspection query in the URL because it’s expecting a GraphQL server to be listening at that URL.

Downloading of static schemas isn’t a supported workflow for the `fetch-schema` method. I recommend you rather download your static schema just using something like `curl` and then just feed it into the codegen as an input.

> Problem Statement 2 - How can I do all the Schema Init and generate and fetch schema in a CI/CD pipeline, I am using Bitrise for that?

Init is always separate because the initialization parameters used in a fresh configuration file are default parameters that still need to be changed for your configuration.

Fetching the schema and generation can be done in one step but as I said above, fetching a static schema isn’t a supported workflow.

Your CI could do these steps:

1. Download schema from S3 with `curl`
2. Call `generate` command on Apollo CLI with pre-existing codegen configuration file
