Skip to content

Is this plugin compatible when using multiple runtimes? #43

Open
@riltsken

Description

@riltsken

Heya. First off just wanted to say this plugin made my life a whole lot easier by not dealing with compilation configuration :)

The current issue I am running into is that I wanted to add a python lambda alongside my typescript lambdas. Regardless of my tsconfig / serverless.yml I can't seem to prevent serverless-plugin-typescript from trying to compile my python functions.

If you think this is NOT an issue with serverless-plugin-typescript I am happy to investigate more, but my current understanding is that this seems to be the culprit since I don't expect it to be jumping into my non-typescript folders.

If you think this is an issue that is easily fixable I am happy to dive in, but I just wanted to make sure I wasn't missing something and any direction you might provide before I do so.

My current layout is the following

root
 \_funcs
   \_geocode
   \_queue
 \_funcs_python
   \_logentries
 \_serverless.yml
 \_tsconfig.json

tsconfig

    "compilerOptions": {
        "allowSyntheticDefaultImports": false,
        "alwaysStrict": true,
        "allowJs": true,
        "declaration": false,
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "noImplicitAny": false,
        "noUnusedLocals": true,
        "suppressImplicitAnyIndexErrors": false,
        "outDir": ".build",
        "rootDir": "./",
        "target": "es5",
        "lib": ["es2015"],
        "sourceMap": true,
        "alwaysStrict": true
    },
    "include": ["funcs/**/*.ts"],
    "compileOnSave": false,
    "atom": {
        "rewriteTsconfig": false
    },
    "exclude": [
        "dist"
    ]

serverless.yml (couple things omitted for privacy

service: mapping
frameworkVersion: "=1.22.0"
stage: dev

provider:
  name: aws
  runtime: nodejs6.10
  memorySize: 128
  timeout: 5

package:
  excludeDevDependencies: true
  include:
    - node_modules/**/*
    - funcs/**/*.ts

functions:
  geocode:
    name: ${self:service}-geocode
    handler: funcs/geocode/index.main
  queue:
    name: ${self:service}-queue
    handler: funcs/queue/index.main
  logentries:
    name: ${self:service}-logentries
    handler: funcs_python/logentries/main.lambda_handler
    runtime: python2.7

plugins:
  - serverless-plugin-typescript
  - serverless-prune-plugin

custom:
  prune:
    automatic: true
    number: 5

Error

$ SLS_DEBUG=* . ./settings.staging.sh && serverless deploy -s staging
Serverless: Load command run
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command create
Serverless: Load command install
Serverless: Load command package
Serverless: Load command deploy
Serverless: Load command deploy:function
Serverless: Load command deploy:list
Serverless: Load command deploy:list:functions
Serverless: Load command invoke
Serverless: Load command invoke:local
Serverless: Load command info
Serverless: Load command logs
Serverless: Load command login
Serverless: Load command logout
Serverless: Load command metrics
Serverless: Load command remove
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command slstats
Serverless: Load command plugin
Serverless: Load command plugin
Serverless: Load command plugin:install
Serverless: Load command plugin
Serverless: Load command plugin:uninstall
Serverless: Load command plugin
Serverless: Load command plugin:list
Serverless: Load command plugin
Serverless: Load command plugin:search
Serverless: Load command emit
Serverless: Load command config
Serverless: Load command config:credentials
Serverless: Load command rollback
Serverless: Load command rollback:function
Serverless: Load command prune
Serverless: Invoke deploy
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:common:cleanupTempDir
Serverless: Compiling with Typescript...
Serverless: Using local tsconfig.json
{ file: undefined,
  start: undefined,
  length: undefined,
  messageText: 'File \'funcs_python/logentries/main.ts\' not found.',
  category: 1,
  code: 6053 }
 
  Type Error ---------------------------------------------
 
  Cannot read property 'getLineAndCharacterOfPosition' of undefined
 
     For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
 
  Stack Trace --------------------------------------------
 
TypeError: Cannot read property 'getLineAndCharacterOfPosition' of undefined
    at allDiagnostics.forEach.diagnostic (/home/storiel/work/mapping/lambda/node_modules/serverless-plugin-typescript/dist/src/typescript.js:71:56)
    at Array.forEach (native)
    at Object.<anonymous> (/home/storiel/work/mapping/lambda/node_modules/serverless-plugin-typescript/dist/src/typescript.js:67:24)
    at Generator.next (<anonymous>)
    at /home/storiel/work/mapping/lambda/node_modules/serverless-plugin-typescript/dist/src/typescript.js:7:71
    at __awaiter (/home/storiel/work/mapping/lambda/node_modules/serverless-plugin-typescript/dist/src/typescript.js:3:12)
    at Object.run (/home/storiel/work/mapping/lambda/node_modules/serverless-plugin-typescript/dist/src/typescript.js:62:12)
    at TypeScriptPlugin.<anonymous> (/home/storiel/work/mapping/lambda/node_modules/serverless-plugin-typescript/dist/src/index.js:110:50)
    at Generator.next (<anonymous>)
    at /home/storiel/work/mapping/lambda/node_modules/serverless-plugin-typescript/dist/src/index.js:7:71
    at __awaiter (/home/storiel/work/mapping/lambda/node_modules/serverless-plugin-typescript/dist/src/index.js:3:12)
    at TypeScriptPlugin.compileTs (/home/storiel/work/mapping/lambda/node_modules/serverless-plugin-typescript/dist/src/index.js:99:16)
    at BbPromise.reduce (/home/storiel/.nvm/versions/node/v7.10.1/lib/node_modules/serverless/lib/classes/PluginManager.js:358:55)
From previous event:
    at PluginManager.invoke (/home/storiel/.nvm/versions/node/v7.10.1/lib/node_modules/serverless/lib/classes/PluginManager.js:358:22)
    at PluginManager.spawn (/home/storiel/.nvm/versions/node/v7.10.1/lib/node_modules/serverless/lib/classes/PluginManager.js:376:17)
    at Deploy.BbPromise.bind.then.then (/home/storiel/.nvm/versions/node/v7.10.1/lib/node_modules/serverless/lib/plugins/deploy/deploy.js:117:50)
From previous event:
    at Object.before:deploy:deploy [as hook] (/home/storiel/.nvm/versions/node/v7.10.1/lib/node_modules/serverless/lib/plugins/deploy/deploy.js:107:10)
    at BbPromise.reduce (/home/storiel/.nvm/versions/node/v7.10.1/lib/node_modules/serverless/lib/classes/PluginManager.js:358:55)
From previous event:
    at PluginManager.invoke (/home/storiel/.nvm/versions/node/v7.10.1/lib/node_modules/serverless/lib/classes/PluginManager.js:358:22)
    at PluginManager.run (/home/storiel/.nvm/versions/node/v7.10.1/lib/node_modules/serverless/lib/classes/PluginManager.js:389:17)
    at variables.populateService.then (/home/storiel/.nvm/versions/node/v7.10.1/lib/node_modules/serverless/lib/Serverless.js:99:33)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)
From previous event:
    at Serverless.run (/home/storiel/.nvm/versions/node/v7.10.1/lib/node_modules/serverless/lib/Serverless.js:86:74)
    at serverless.init.then (/home/storiel/.nvm/versions/node/v7.10.1/lib/node_modules/serverless/bin/serverless:39:50)
 
  Get Support --------------------------------------------
     Docs:          docs.serverless.com
     Bugs:          github.com/serverless/serverless/issues
     Forums:        forum.serverless.com
     Chat:          gitter.im/serverless/serverless
 
  Your Environment Information -----------------------------
     OS:                     linux
     Node Version:           7.10.1
     Serverless Version:     1.22.0
 
error Command failed with exit code 1.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions