Home
Support Forums

Decorators not working in functions - TypeORM & Typegraphql libraries are broken

Build

    11:25:41 AM: Build ready to start
    11:25:42 AM: build-image version: 0582042f4fc261adc7bd8333f34884959c577302
    11:25:42 AM: build-image tag: v3.7.6
    11:25:42 AM: buildbot version: eb306760e81a03804ba3726a12e10606b0269209
    11:25:43 AM: Fetching cached dependencies
    11:25:43 AM: Starting to download cache of 196.9MB
    11:25:44 AM: Finished downloading cache in 1.843420947s
    11:25:44 AM: Starting to extract cache
    11:25:51 AM: Finished extracting cache in 7.022765501s
    11:25:51 AM: Finished fetching cache in 8.909029297s
    11:25:51 AM: Starting to prepare the repo for build
    11:25:52 AM: Preparing Git Reference refs/heads/master
    11:25:53 AM: Parsing package.json dependencies
    11:25:54 AM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'dist' versus 'dist/' in the Netlify UI
    11:25:54 AM: Starting build script
    11:25:54 AM: Installing dependencies
    11:25:54 AM: Python version set to 2.7
    11:25:54 AM: Started restoring cached node version
    11:25:57 AM: Finished restoring cached node version
    11:25:58 AM: v16.0.0 is already installed.
    11:25:59 AM: Now using node v16.0.0 (npm v7.10.0)
    11:25:59 AM: Started restoring cached build plugins
    11:25:59 AM: Finished restoring cached build plugins
    11:25:59 AM: Attempting ruby version 2.7.1, read from environment
    11:26:00 AM: Using ruby version 2.7.1
    11:26:00 AM: Using PHP version 5.6
    11:26:00 AM: Started restoring cached yarn cache
    11:26:00 AM: Finished restoring cached yarn cache
    11:26:01 AM: No yarn workspaces detected
    11:26:01 AM: Started restoring cached node modules
    11:26:01 AM: Finished restoring cached node modules
    11:26:01 AM: Installing NPM modules using Yarn version 1.22.4
    11:26:02 AM: yarn install v1.22.4
    11:26:02 AM: [1/4] Resolving packages...
    11:26:02 AM: success Already up-to-date.
    11:26:02 AM: Done in 0.68s.
    11:26:02 AM: NPM modules installed using Yarn
    11:26:03 AM: Started restoring cached go cache
    11:26:03 AM: Finished restoring cached go cache
    11:26:03 AM: go version go1.14.4 linux/amd64
    11:26:03 AM: go version go1.14.4 linux/amd64
    11:26:03 AM: Installing missing commands
    11:26:03 AM: Verify run directory
    11:26:04 AM: ​
    11:26:04 AM: ────────────────────────────────────────────────────────────────
    11:26:04 AM:   Netlify Build                                                 
    11:26:04 AM: ────────────────────────────────────────────────────────────────
    11:26:04 AM: ​
    11:26:04 AM: ❯ Version
    11:26:04 AM:   @netlify/build 11.24.0
    11:26:04 AM: ​
    11:26:04 AM: ❯ Flags
    11:26:04 AM:   deployId: 60af57854590a80008928d60
    11:26:04 AM: ​
    11:26:04 AM: ❯ Current directory
    11:26:04 AM:   /opt/build/repo
    11:26:04 AM: ​
    11:26:04 AM: ❯ Config file
    11:26:04 AM:   /opt/build/repo/netlify.toml
    11:26:04 AM: ​
    11:26:04 AM: ❯ Context
    11:26:04 AM:   production
    11:26:04 AM: ​
    11:26:04 AM: ────────────────────────────────────────────────────────────────
    11:26:04 AM:   1. Build command from Netlify app                             
    11:26:04 AM: ────────────────────────────────────────────────────────────────
    11:26:04 AM: ​
    11:26:04 AM: $ yarn build
    11:26:04 AM: yarn run v1.22.4
    11:26:04 AM: $ node node_modules/.bin/tsc -p . --outDir ./dist
    11:26:10 AM: Done in 5.36s.
    11:26:10 AM: ​
    11:26:10 AM: (build.command completed in 5.6s)
    11:26:10 AM: ​
    11:26:10 AM: ────────────────────────────────────────────────────────────────
    11:26:10 AM:   2. Functions bundling                                         
    11:26:10 AM: ────────────────────────────────────────────────────────────────
    11:26:10 AM: ​
    11:26:10 AM: Packaging Functions from netlify/functions directory:
    11:26:10 AM:  - users-api-gql/users-api-gql.ts
    11:26:10 AM: ​
    11:26:24 AM: ​
    11:26:24 AM: (Functions bundling completed in 14.3s)
    11:26:24 AM: ​
    11:26:24 AM: ────────────────────────────────────────────────────────────────
    11:26:24 AM:   3. Deploy site                                                
    11:26:24 AM: ────────────────────────────────────────────────────────────────
    11:26:24 AM: ​
    11:26:24 AM: Starting to deploy site from 'dist'
    11:26:24 AM: Creating deploy tree 
    11:26:24 AM: Creating deploy upload records
    11:26:24 AM: 1 new files to upload
    11:26:24 AM: 1 new functions to upload
    11:26:27 AM: Site deploy was successfully initiated
    11:26:27 AM: ​
    11:26:27 AM: (Deploy site completed in 2.8s)
    11:26:27 AM: ​
    11:26:27 AM: ────────────────────────────────────────────────────────────────
    11:26:27 AM:   Netlify Build Complete                                        
    11:26:27 AM: ────────────────────────────────────────────────────────────────
    11:26:27 AM: ​
    11:26:27 AM: (Netlify Build completed in 22.8s)
    11:26:27 AM: Starting post processing
    11:26:27 AM: Post processing - HTML
    11:26:27 AM: Post processing - header rules
    11:26:27 AM: Post processing - redirect rules
    11:26:27 AM: Post processing done
    11:26:27 AM: Caching artifacts
    11:26:27 AM: Started saving node modules
    11:26:27 AM: Finished saving node modules
    11:26:27 AM: Started saving build plugins
    11:26:27 AM: Finished saving build plugins
    11:26:27 AM: Started saving yarn cache
    11:26:27 AM: Finished saving yarn cache
    11:26:27 AM: Started saving pip cache
    11:26:27 AM: Finished saving pip cache
    11:26:27 AM: Started saving emacs cask dependencies
    11:26:27 AM: Finished saving emacs cask dependencies
    11:26:27 AM: Started saving maven dependencies
    11:26:27 AM: Finished saving maven dependencies
    11:26:27 AM: Site is live ✨
    11:26:27 AM: Started saving boot dependencies
    11:26:27 AM: Finished saving boot dependencies
    11:26:27 AM: Started saving rust rustup cache
    11:26:27 AM: Finished saving rust rustup cache
    11:26:27 AM: Started saving go dependencies
    11:26:27 AM: Finished saving go dependencies
    11:26:28 AM: Build script success
    11:27:03 AM: Finished processing build request in 1m20.273291905s

My netlify.toml file

[functions]
  external_node_modules = ["app-root-path", "express", "type-graphql", "typeorm", "reflect-metadata", "typedi", "typeorm-typedi-extensions"]
  included_files = ["src/**"]

I tried multiple configurations but with no success

My tsconfig.json file

{
  "version": "2.4.2",
  "compilerOptions": {
    "lib": [
      "es5",
      "es6",
      "esnext.asynciterable"
    ],
    "target": "es6",
    "module": "commonjs",
    "moduleResolution": "node",
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "isolatedModules": true,
    "esModuleInterop": true,
    "sourceMap": true,
    "outDir": "./dist",
    "skipLibCheck": true,
    "strict": true
  },
  "exclude": [
    "node_modules",
    "tests"
  ]
}

The issue is that apparently the tsconfig.json file is not read as the libraries can’t use decorators in typescript.

I get errors on both libraries that use decorators: typeorm and typegraphql.

I assumed that either I need to include other files or library but have no idea why it’s not working.
I get the same errors on netlify dev as well.

Update:
To test I changed the outDir to ./test in my tsconfig.json. This change was not read by netlify when deploying so I assume that netlify doesn’t read the tsconfig.json file

Hey there, @etudor :wave:

Welcome to the Netlify Forums! Thanks for reaching out about this, and apologies for the delay in response.

Are you still experiencing this issue?

Hi, I have the same dependencies on TypeORM & TypeGraphQL and am still experiencing this issue.

@hillary is tsconfig.json being properly consumed in netlify dev?

Hey all! I wanted to check in and see if any recent release has helped?

Our CLI team are hard at work improving this feature. You may wish to create an issue in the public product repo for the best, most targeted support.