Nestjs GraphQL typePaths include_files not working

I have NX project with an nestjs application. I am not able to load the type graphql file. I tried pretty much everything.

app.module.ts

GraphQLModule.forRootAsync<ApolloDriverConfig>({
      driver: ApolloDriver,
      useFactory: async (configService: ConfigService)  => ({
        typePaths: configService.get('GRAPHQL_TYPE_PATHS'),
        definitions: {
          path: configService.get('GRAPHQL_TYPE_DEFS_PATH'),
          outputAs: 'class',
        },
      }),
      inject: [ConfigService],
    }),

netlify.toml:

[functions]
included_files = [“./schema/spacez.schema.graphql”]

NX project

“assets”: [
“apps/api/src/assets”,
“apps/api/src/netlify.toml”,
“apps/api/src/schedule.js”,
“apps/api/src/schema”
],

I was expecting the file be under apps/api/schema/spacez.schema.graphql but it does not seem to be included. Anybody has an idea what I am doing wrong?

What site/deploy is this about?

Hi,

The site is spacebrainz-api. Still in development.

Cheers
Olaf

I don’t see any netlify.toml being used for your deploy: Deploy details | Deploys | spacebrainz-api | Netlify. Have you set the package directory correctly: Monorepos | Netlify Docs?

Each project has its own netlify.toml. Under the apps > api, you can see the netlify.toml file. When compiled, the file is being moved to the dist folder. I also include the graphql type file in nx assets to be moved to dist folder.

I can’t. I don’t have acesss to your repo.

netlify.toml is not supposed to be moved anywhere.

Please put together a minimal reproduction, as there’s definitely some configuration error on your end, and understanding/explaining that might not be easy.

Ok, I will setup a striped down version. For now, here is my folder structure of the project.

.
├── apps
│   ├── api
│   │   ├── project.json
│   │   └── src
│   │       ├── app
│   │       ├── assets
│   │       ├── environments
│   │       ├── main.ts
│   │       └── netlify.toml
│   └── spacez-marketplace-v2
│       ├── netlify.toml
│       └── project.json
├── libs
│   ├── marketplace
│   └── ...
├── package.json
├── nx.json
└── ...

The project.json for the api is as follows:

{
  "name": "api",
  "$schema": "../../node_modules/nx/schemas/project-schema.json",
  "sourceRoot": "apps/api/src",
  "projectType": "application",
  "targets": {
    "build": {
      "executor": "@nrwl/webpack:webpack",
      "outputs": [
        "{options.outputPath}"
      ],
      "defaultConfiguration": "production",
      "options": {
        "target": "node",
        "compiler": "tsc",
        "outputPath": "dist/apps/api",
        "main": "apps/api/src/main.ts",
        "tsConfig": "apps/api/tsconfig.app.json",
        "assets": [
          "apps/api/src/assets",
          "apps/api/src/netlify.toml",
          "apps/api/src/schedule.js",
          "apps/api/src/schema"
        ],
        "webpackConfig": "apps/api/webpack.config.js"
      },
      "configurations": {
        "development": {},
        "production": {}
      }
    },
    "serve": {
      "executor": "@nrwl/js:node",
      "defaultConfiguration": "development",
      "options": {
        "buildTarget": "api:build"
      },
      "configurations": {
        "development": {
          "buildTarget": "api:build:development"
        },
        "production": {
          "buildTarget": "api:build:production"
        }
      }
    },
    "lint": {
      "executor": "@nrwl/linter:eslint",
      "outputs": [
        "{options.outputFile}"
      ],
      "options": {
        "lintFilePatterns": [
          "apps/api/**/*.ts"
        ]
      }
    },
    "test": {
      "executor": "@nrwl/jest:jest",
      "outputs": [
        "{workspaceRoot}/coverage/{projectRoot}"
      ],
      "options": {
        "jestConfig": "apps/api/jest.config.ts",
        "passWithNoTests": true
      },
      "configurations": {
        "ci": {
          "ci": true,
          "codeCoverage": true
        }
      }
    }
  },
  "tags": []
}

And here is my netlify.toml

[build]
    command = "nx run api:build:production"
    publish = "./site/"
    functions = "../../dist/apps/api"

[functions]
    included_files = ["./schema/*"]

[[redirects]]
    from = "/*"
    to = "/.netlify/functions/main"
    status = 200

[[headers]]
    for = "/*"
    [headers.values]
    Access-Control-Allow-Origin = "*"
    Content-Type = "application/json"