serverless / serverless-plugin-typescript

Serverless plugin for zero-config Typescript support
MIT License
784 stars 224 forks source link

Adding plugin prevents deployment #262

Closed Oldbury closed 2 years ago

Oldbury commented 2 years ago

Issue

When adding plugin to Serverless it prevents the deployment from completing. This issue occurs with Serverless-plugin-typescript and serverless-esbuild

Serverless.yml

frameworkVersion: "2"

provider:
  name: aws
  runtime: nodejs12.x
  stage: dev
  region: eu-west-2
  httpApi:
    cors: true

custom:
  esbuild:
    packager: yarn

plugins:
  - serverless-plugin-typescript
  - serverless-plugin-monorepo
  - serverless-offline
  # - serverless-esbuild
  # - serverless-prune-plugin

functions:
  get-user:
    handler: "./modules/users/get/handler.GetUser"
    events:
      - httpApi:
          path: /users/{userId}
          method: GET
  create-user:
    handler: "./modules/users/create/handler.CreateUser"
    events:
      - httpApi:
          path: /users
          method: POST

Package.json

{
  "name": "apis",
  "version": "1.0.0",
  "license": "MIT",
  "dependencies": {
    "@types/node": "^17.0.8",
    "config": "*",
    "serverless-esbuild": "^1.23.3",
    "serverless-offline": "^8.3.1",
    "serverless-plugin-monorepo": "^0.11.0",
    "serverless-plugin-typescript": "^2.1.0",
    "serverless-prune-plugin": "^2.0.1",
    "typescript": "^4.5.4",
    "esbuild": "^0.14.11"
  }
}

Output

➜  apis git:(main) ✗ sls deploy
simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this will be an error in version 3
Serverless: Deprecation warning: Starting with next major version, default value of provider.lambdaHashingVersion will be equal to "20201221"
            More Info: https://www.serverless.com/framework/docs/deprecations/#LAMBDA_HASHING_VERSION_V2
Serverless: Cleaning dependency symlinks
Serverless: Creating dependency symlinks
Serverless: Compiling to node12 bundle with esbuild...
Serverless: Compiling with concurrency: Infinity
Serverless: Compiling completed.

Expected Result

Functions deploy as usual, which was happening before adding the typescript plugin

medikoo commented 2 years ago

@Oldbury do you mean that deployment freezes? What exactly is wrong? It's not clear from provided information

Oldbury commented 2 years ago

I mean that it compiles the typescript and generated the .build directory but stops after that (see output in description).

I expected it to then carry on with the deployment

medikoo commented 2 years ago

What happens if you just use serverless-plugin-typescript, and do not load other plugins?

If the issue persists then, can you prepare some reproducible test case I can check on my machine?

Oldbury commented 2 years ago

The same issue occurs with just serverless-plugin-typescript - it is worth noting I am using turbo repo too.

I'll test again tonight with a blank example repo and see if this issue still occurs

https://user-images.githubusercontent.com/10517525/149529443-7601402a-61bd-4989-ba55-e7f3ccd177a9.mov

medikoo commented 2 years ago

Interesting, it looks that after packaging command just exists. What version of the serverless you're using, is it the latest?

Oldbury commented 2 years ago

Okay so I'm not 100% sure what Serverless version I was on before but just upgraded to latest "serverless@2.71.0" and its now working as expected with Serverless-plugin-typescript