serverless / serverless-plugin-typescript Goto Github PK
View Code? Open in Web Editor NEWServerless plugin for zero-config Typescript support
License: MIT License
Serverless plugin for zero-config Typescript support
License: MIT License
Does this plugin work on windows?
I get the following error when I attempt to use this plugin.
EPERM: operation not permitted, symlink 'C:\Users\Dale\Development\www.dalejefferson.com\node_modules' -> 'C:\Users\Dale\Development\www.dalejefferson.com\.build\node_modules'
I'm using a tsconfig.json that contains module aliases like so:
"paths": {
"actions/*": ["src/actions/*"],
"components/*": ["src/components/*"],
"reducers/*": ["src/reducers/*"],
"services/*": ["src/services/*"],
"styles/*": ["src/styles/*"],
"utils/*": ["src/utils/*"],
"views/*": ["src/views/*"]
}
Unfortunately, this plugin does not interpret these aliases. So doing something like:
import { someCoolUtil } from 'utils/someCoolUtil'
Ends up compiling to:
var someCoolUtil_1 = require("utils/someCoolUtil");
Not sure if this is a bug or an issue with my implementation, but these path mappings work perfectly fine when my project is compiled using awesome-typescript-loader in Webpack.
Hey,
I've just recently started trying out serverless framework and this plugin just today. So sorry in case things are a bit inaccurate :)
My problem is that, together with the typescript-plugin, the core's package plugin fails to properly exclude development dependencies from the build/package. This way even a simple "hello world" function has a footprint of roughly 15MB, where it should be just about 2 kB.
Problem seems to be, that package plugin just calls npm ls --dev=true ...
and npm ls --prod=true ...
and diffs the output of those two. With this plugin these shell calls are done from the .build
folder, yet npm ls --dev=true ...
fails to properly list all the dependencies as it stumbles over the symlinking.
Seems like it doesn't expect deduped/flattened dir structure then.
Replacing both symlinkSync
calls by copySync
immediately fixes the problem so :)
... yet I'm unsure if there's a better way to do that ...
regards
There is a know problem on windows when the creation of symbolic links are need. The UAC filter the symbolic link permission and don't let the user use it. You must open the console as administrator to use this resource.
PS C:\Jose\Dropbox\Github\AutoKariam> serverless invoke local -f hello
Serverless: Compiling with Typescript...
Using local tsconfig.json
Error --------------------------------------------------
EPERM: operation not permitted, symlink 'C:\Jose\Dropbox\Github\AutoKariam\node_modules' -> 'C:\Jose\Dropbox\Github\AutoKariam.
build\node_modules'
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Stack Trace --------------------------------------------
Error: EPERM: operation not permitted, symlink 'C:\Jose\Dropbox\Github\AutoKariam\node_modules' -> 'C:\Jose\Dropbox\Github\AutoKariam.build\node_modules'
at Object.fs.symlinkSync (fs.js:961:18)
at ServerlessPlugin. (C:\Jose\Dropbox\Github\AutoKariam\node_modules\serverless-plugin-typescript\dist\src\index.js:80:20)
at Generator.next ()
at fulfilled (C:\Jose\Dropbox\Github\AutoKariam\node_modules\serverless-plugin-typescript\dist\src\index.js:4:58)
at process._tickDomainCallback (internal/process/next_tick.js:129:7)
From previous event:
at PluginManager.invoke (C:\Users\José\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:217:22)
at PluginManager.run (C:\Users\José\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:236:17)
at variables.populateService.then (C:\Users\José\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:107:33)
at runCallback (timers.js:649:20)
at tryOnImmediate (timers.js:622:5)
at processImmediate [as _immediateCallback] (timers.js:594:5)
From previous event:
at Serverless.run (C:\Users\José\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:94:74)
at serverless.init.then (C:\Users\José\AppData\Roaming\npm\node_modules\serverless\bin\serverless:30:50)
https://github.com/jprichardson/node-fs-extra#windows
https://ember-cli.com/user-guide/#enabling-symlinks
https://github.com/jprichardson/node-fs-extra/blob/master/docs/copy-sync.md
https://nodejs.org/api/fs.html#fs_fs_symlinksync_target_path_type
https://stackoverflow.com/questions/39106516/node-fs-copy-a-folder
Given:
/
services/
serviceOne
serverless.yml
```
This plugin will try to copy node_modules from `serviceOne` and not the project root.
I've seen that there is now support for google as a provider with one of the somewhat recent changes, but it would be awesome to also include support for OpenWhisk. I'm going to look to see if I can figure out what would be involved in this, but if anybody has any great thoughts / feelings about this I would be very appreciative!
.key (googleCloud) or .json config files might be copied after compile code process. Otherwise Lambda returns a module error b/c file isn't there.
Use example -------
const visionApi = googleVision({ projectId: 'awesome-project-168122', keyFilename: './my-service-accout.json', });
Error example -----------
Unable to import module 'handler': Error
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/var/task/node_modules/grpc/src/node/src/grpc_extension.js:30:15)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
Currently, the code for this plugin copies the entire node_modules directory into the zip package. There are several packages (like this one) that don't need to be copied in there.
One solution would be to run npm install --production
instead of copying in node_modules, but I don't think that's ideal as it takes time and doesn't necessarily copy the exact same modules that have been installed into node_modules. I'm not sure if just iterating over dependencies
or devDependencies
for specific inclusion or exclusion is good either.
Hi,
I noticed something that may or may not be significant.
#serverless.yml
plugins:
- serverless-plugin-typescript
#tsconfig.json
"outDir": "SuperFlyOutDir",
If I run tsc
tsc
# Creates a directory named SuperFlyOutDir.
ls -alh
drwxr-xr-x 11 jfgrissom staff 352B Feb 6 20:16 SuperFlyOutDir
If I run serverless invoke local
serverless invoke local -f someFunctionName
# Creates a .build directory instead of SuperFlyOutDir.
This seems broken? But I'm not sure if there is just something I'm missing.
Regardless of the value put in ourDir (build, deploy, SuperFly) .build is always created.
sls invoke should build a dir named SuperFlyOutDir not .build
Is this a correct assessment or am I missing something?
Question: Would it be good to add things like the "serve" and "run" function from Webpack?
I need to test things locally, and this might be a good way to go if we can't integrate natively with other modules like serverless-simulate or serverless-local. It's not a complete solution but might be a simpler option then running one of these other modules and supporting them directly.
I notice that to get get source maps working it suggests that Webpack is required.
Is there any instructions on using this plugin with Webpack? Is it as simple as using the https://github.com/serverless-heaven/serverless-webpack plugin?
Here is a reproducible test case. To reproduce the error:
git clone https://github.com/venkatramachandran/ts-sample
cd ts-sample
npm run make
npm run pack
I get the following error stack at the last step:
Serverless: Packaging service...
Type Error ---------------------------------------------
Path must be a string. Received undefined
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Stack Trace --------------------------------------------
TypeError: Path must be a string. Received undefined
at assertPath (path.js:7:11)
at Object.basename (path.js:1362:5)
at TypeScriptPlugin.<anonymous> (/mnt/c/Users/venkat.ramachandran/ts-sample/node_modules/serverless-plugin-typescript/dist/src/index.js:162:115)
at next (native)
at fulfilled (/mnt/c/Users/venkat.ramachandran/ts-sample/node_modules/serverless-plugin-typescript/dist/src/index.js:4:58)
From previous event:
at PluginManager.invoke (/mnt/c/Users/venkat.ramachandran/ts-sample/node_modules/serverless/lib/classes/PluginManager.js:261:22)
at PluginManager.run (/mnt/c/Users/venkat.ramachandran/ts-sample/node_modules/serverless/lib/classes/PluginManager.js:292:17)
at variables.populateService.then (/mnt/c/Users/venkat.ramachandran/ts-sample/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 (/mnt/c/Users/venkat.ramachandran/ts-sample/node_modules/serverless/lib/Serverless.js:86:74)
at serverless.init.then (/mnt/c/Users/venkat.ramachandran/ts-sample/node_modules/serverless/bin/serverless:39:50)
The specific line where this happens is src/index.ts.
We are running a setup where we have a serverless lambda folder and an npm folder and have a symlink setup. It works great, but when we run tsc in the npm folder, serverless goes into 'Compiling with Typescript...' infinitely. Here is a screenshot of it:
https://www.evernote.com/l/ADZ0T1hOKCBG97dyqtz5qStX2_Yg0EmpxjY
I think the watch folder just needs to ignore the node_modules folder, but not sure if that is an option.
error:
messageText: 'File \'my-folder/ts.handler\' has unsupported extension. The only supported extensions are \'.ts\', \'.tsx\', \'.d.ts\'.',
this code in typescript.ts file
export function extractFileNames(functions: { [key: string]: ServerlessFunction }): string[] {
return _.values(functions)
.map(fn => fn.handler)
.map(h => {
const fnName = _.last(h.split('.'))
return h.replace(fnName, 'ts')
})
}
the replaces get applied to both the function name and filename if they match
Serverless: Compiling with Typescript...
Serverless: Using local tsconfig.json
Type Error ---------------------------------------------
Path must be a string. Received undefined
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Stack Trace --------------------------------------------
TypeError: Path must be a string. Received undefined
at assertPath (path.js:7:11)
at Object.resolve (path.js:1146:7)
at Object.getTypescriptConfig (./node_modules/serverless-plugin-typescript/src/typescript.ts:96:14)
at ServerlessPlugin.<anonymous> (./node_modules/serverless-plugin-typescript/src/index.ts:122:33)
at Generator.next (<anonymous>)
at ./node_modules/serverless-plugin-typescript/dist/src/index.js:7:71
at __awaiter (./node_modules/serverless-plugin-typescript/dist/src/index.js:3:12)
at ServerlessPlugin.compileTs (./node_modules/serverless-plugin-typescript/dist/src/index.js:99:16)
at BbPromise.reduce (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:218:55)
From previous event:
at PluginManager.invoke (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:218:22)
at PluginManager.spawn (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:230:17)
at Deploy.BbPromise.bind.then.then (/usr/local/lib/node_modules/serverless/lib/plugins/deploy/deploy.js:101:50)
From previous event:
at Object.before:deploy:deploy [as hook] (/usr/local/lib/node_modules/serverless/lib/plugins/deploy/deploy.js:99:10)
at BbPromise.reduce (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:218:55)
From previous event:
at PluginManager.invoke (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:218:22)
at PluginManager.run (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:237:17)
at variables.populateService.then (/usr/local/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 (/usr/local/lib/node_modules/serverless/lib/Serverless.js:86:74)
at serverless.init.then (/usr/local/lib/node_modules/serverless/bin/serverless:39:50)
Here's the problematic code I believe:
// disallow overrriding rootDir
if (path.resolve(configParseResult.options.rootDir) !== path.resolve(cwd) && logger) {
logger.log('Warning: "rootDir" from local tsconfig.json is overriden')
Hello!
I've set up the project correctly.
When I invoke locally the following code
const fetchSomething = () => new Promise((resolve, reject) => {
setTimeout(() => {
resolve({
some: 'thing',
})
}, 1000)
})
export const asyncTest = async (event: APIGatewayEvent) => {
const x = await fetchSomething()
return {
statusCode: 200,
body: JSON.stringify(x),
}
}
Nothing is returned.
I've tested using callbacks in this same project and it works as expected
This plugin should handle having handles with both the .js and .ts extension, and simply not transpile the .js files.
I wanted to convert my current serverless project to TS, and only rename TS files once I've updated them.
Currently we get an error that looks like
Serverless: Using local tsconfig.json
{ file: undefined,
start: undefined,
length: undefined,
messageText: 'File \'myfunction.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.
I have a simple setup so far regarding a particular service.
The serverless.yml is setup like so:
provider:
name: aws
runtime: nodejs6.10
functions:
uploadAudio:
handler: <handlerLcation>
role: <aws role>
package:
individually: true
include:
- "../ffmpeg/linux_64/ffmpeg"
- "../ffmpeg/linux_64/ffprobe"
uploadAsset:
handler: <handlerLocation>
role: <aws role>
getAsset:
handler: <handlerLocation>
role: <aws role>
Basically, the UploadAudio
function has a dependency on ffmpeg, so I want to package this individually to keep the size of the other functions down.
However, I get this error:
Error: ENOENT: no such file or directory, open '<projectHome>/src/main/resource-server/.build/.serverless/uploadAudio.zip'
at Error (native)
at Object.fs.openSync (fs.js:641:18)
at Object.fs.readFileSync (fs.js:509:33)
at AwsCompileFunctions.compileFunction (/usr/local/lib/node_modules/serverless/lib/plugins/aws/package/compile/functions/index.js:290:24)
at serverless.service.getAllFunctions.forEach (/usr/local/lib/node_modules/serverless/lib/plugins/aws/package/compile/functions/index.js:332:39)
at Array.forEach (native)
at AwsCompileFunctions.compileFunctions (/usr/local/lib/node_modules/serverless/lib/plugins/aws/package/compile/functions/index.js:332:8)
at BbPromise.reduce (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:360:55)
From previous event:
at PluginManager.invoke (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:360:22)
at PluginManager.run (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:391:17)
at variables.populateService.then (/usr/local/lib/node_modules/serverless/lib/Serverless.js:99:33)
at runCallback (timers.js:666:20)
at tryOnImmediate (timers.js:639:5)
at processImmediate [as _immediateCallback] (timers.js:611:5)
From previous event:
at Serverless.run (/usr/local/lib/node_modules/serverless/lib/Serverless.js:86:74)
at serverless.init.then (/usr/local/lib/node_modules/serverless/bin/serverless:39:50)
I'm not sure why. I can also verify that the uploadAudio.zip
file exists in the .build/.serverless
folder during the build process. In fact, the file does get copied over to the final .serverless
folder after the build throws the error.
I still get this error if I remove the include
section. It seems to be an issue with the individually
parameter.
It compiles and packages just fine if I don't set this to compile individually and just include
the library in to the entire service. This is not ideal as the other functions do not need this library.
Is there a configuration or something that I am missing?
I don't seem to be able to use this with serverless deploy function -f functionName
- I'm not sure what gets deployed, but whatever it is it doesn't work, and the Compiling typescript
line doesn't come up in the command's output...
Awesome tool in general though!
When I deployed the example in the example directory, I get the following error:
`❯ sls deploy
Serverless: Compiling with Typescript...
handler.ts (3,42): Cannot find name 'setTimeout'.
Serverless: Packaging service...
Serverless: Logging in to Azure
Serverless: Looking for deployed functions that are not part of the current deployment...
Serverless: Creating resource group: -rg
Serverless: Creating function app:
Serverless: Waiting for Kudu endpoint...
Serverless: Parsing Azure Functions Bindings.json...
Serverless: Building binding for function: hello event: httpTrigger
Serverless: Packaging function: hello
Error --------------------------------------------------
ENOENT: no such file or directory, stat '/Users/nipol/Project/<project name>/handler.js'
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
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: darwin
Node Version: 6.10.0
Serverless Version: 1.11.0
`
The handler.ts file is not converted to handler.js. Where should I approach that plugin?
Tried it this way
# global
package:
individually: true
# ...
functions:
# ...
stateDocuments:
handler: src/Dispatcher.getStateDocuments
package:
include:
- src/assets/**
and this way
# individual
stateDocuments:
package:
individually: true
include:
- src/assets/stateDocuments/
With and without: excludeDevDependencies: false
$ serverless package --verbose
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 offline
Serverless: Load command offline:start
Serverless Warning --------------------------------------
A valid option to satisfy the declaration 'opt:stage' could not be found.
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:common:cleanupTempDir
Type Error ---------------------------------------------
TypeError: Cannot read property 'Symbol(Symbol.iterator)' of undefined
at TypeScriptPlugin.prepare (myproject/node_modules/serverless-plugin-typescript/dist/src/index.js:71:45)
at TypeScriptPlugin.<anonymous> (myproject/node_modules/serverless-plugin-typescript/dist/src/index.js:100:18)
at next (native)
at myproject/node_modules/serverless-plugin-typescript/dist/src/index.js:7:71
at __awaiter (myproject/node_modules/serverless-plugin-typescript/dist/src/index.js:3:12)
at TypeScriptPlugin.compileTs (myproject/node_modules/serverless-plugin-typescript/dist/src/index.js:99:16)
at BbPromise.reduce (/Users/ksuttle/.nvm/versions/node/v6.11.0/lib/node_modules/serverless/lib/classes/PluginManager.js:360:55)
From previous event:
at PluginManager.invoke (/Users/ksuttle/.nvm/versions/node/v6.11.0/lib/node_modules/serverless/lib/classes/PluginManager.js:360:22)
at PluginManager.run (/Users/ksuttle/.nvm/versions/node/v6.11.0/lib/node_modules/serverless/lib/classes/PluginManager.js:391:17)
at variables.populateService.then (/Users/ksuttle/.nvm/versions/node/v6.11.0/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 (/Users/ksuttle/.nvm/versions/node/v6.11.0/lib/node_modules/serverless/lib/Serverless.js:86:74)
at serverless.init.then (/Users/ksuttle/.nvm/versions/node/v6.11.0/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: darwin
Node Version: 6.11.0
Serverless Version: 1.23.0
"serverless-plugin-typescript": "^1.1.2",
If I have the package declaration at the top of the file, globally declared, it works fine, but then that directory and its contents are copied into every lambda function, which is not ideal.
Hi there, thank you so much for developing this plugin, it is awesome! However, I have a major problem: I can only use TS 2.* because it is a direct dependency of the plugin. We need to have typescript
be peer dependency in package.json
so we can use whatever version of TS we see fit.
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
"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"
]
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
$ 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.
It looks like the code does not include any "extra" files that aren't typescript.
For example, I have a "templates" directory of handlebars templates that are not included. I see the plugin supports the "exclude" part of the package directive, but nothing for "include".
Hi. I'm using this plugin on a small project with AWS Lambda. Now I want to add a Lambda authorizer function. The problem is that the plugin does not compile the atuthorizer.ts file. I also noticed that a remnant class that is not used anymore, ie. not referenced by any other file, is not compiled and not included in the build folder. This looks like a neat feature as it keeps the build folder clean, but I want my authorizer function which is referenced just in the serverless.yml file.
Here is the error I got
Serverless: Using local tsconfig.json
{ file: undefined,
start: undefined,
length: undefined,
messageText: 'File \'build/src/routes/authorizer.ts\' not found.',
category: 1,
code: 6053,
reportsUnnecessary: undefined }
Do you have any idea what do I need to do to compile or add this file to the build folder?
I also tried to add it in the package: include section but it's still not there ( and if it wold be copied, it would be ts and not js)
Later Edit: if I run tsc, all the files are compiled as they should.
Later, later edit:
BTW, I want my json schema files to be bundled in the .build folder but I just can't find it there, I need them for ajv validator and swagger
package:
include:
- ./src/**/*.json
Thank you!
LE: it was just me not paying attention, the correct authorizer path should have been src/routes/authorizer.ts
, after I corrected it, the authorizer is compiled as it should and the json files are also copied to the .build forlder
The plugin appears to only compile the .ts
files that contain handler functions. It should support compiling a project based on files/include/exclude in tsconfig.json
.
Use case:
I have my handler in handler.ts
, but I organize my helper functions in files at services/*.ts
. My tsconfig.json
looks like this:
{
"compilerOptions": {
"preserveConstEnums": true,
"strictNullChecks": true,
"sourceMap": true,
"target": "es5",
"outDir": ".build",
"moduleResolution": "node",
"lib": ["es2015"],
"rootDir": "./"
},
"include": [
"services/**/*",
"handler.ts"
]
}
If I run tsc
, all files will be compiled as expected to .build/
. If I build with this plugin, only handler.ts
gets compiled.
Hi!
Would it be possible to add serverless-kubeless support?
Is it possible to generate the JavaScript into the .build folder for other plugins to use? I.e. The mocha unit testing plugin and the offline plugin?
Well,
When we're working with apis, the user has power to send things different of what we were expecting...
To fix that i use ttypescript (https://github.com/cevek/ttypescript) and typescript-is (https://github.com/woutervh-/typescript-is).
Is there someway to use this plugin with serverless-plugin-typescript?
I have problems running the sls offline start
command on a macOS Sierra 10.12.6. All files are generated correctly, but just before the start of the local web server, there is an error. In addition to that, the command sls offline
runs correctly, but since the local dynamodb server is not automatically launched, it is not an option.
$ node --version
v6.11.0
$ npm --version
3.10.10
$ sls version
1.22.0
serverless.yml
plugins:
- serverless-plugin-typescript
- serverless-plugin-browserifier
- serverless-dynamodb-local
- serverless-offline
tsconfig.json
{
"compilerOptions": {
"preserveConstEnums": true,
"strictNullChecks": true,
"alwaysStrict": true,
"sourceMap": true,
"target": "es5",
"outDir": ".build",
"moduleResolution": "node",
"lib": ["es2015"],
"rootDir": "./"
}
}
Output
$ serverless offline start
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 dynamodb
Serverless: Load command dynamodb:migrate
Serverless: Load command dynamodb:seed
Serverless: Load command dynamodb:start
Serverless: Load command dynamodb:noStart
Serverless: Load command dynamodb:remove
Serverless: Load command dynamodb:install
Serverless: Load command offline
Serverless: Load command offline:start
Serverless: Invoke offline:start
Serverless: Compiling with Typescript...
Serverless: Using local tsconfig.json
Serverless: Typescript compiled.
Serverless: Watching typescript files...
events.js:160
throw er; // Unhandled 'error' event
^
Error: spawn java ENOENT
at exports._errnoException (util.js:1018:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:367:16)
at _combinedTickCallback (internal/process/next_tick.js:80:11)
at process._tickDomainCallback (internal/process/next_tick.js:128:9)
Please update documentation for usage of this plugin with the newly released node 8 support in lambda.
there is an issue about this problem but it's closed.
#13
Some other ppl and I still have the problem in that issue. So just to reopen it here.
package.json
{
"name": "aws-credentials-exp",
"version": "1.0.0",
"description": "",
"main": "handler.js",
"dependencies": {
"aws-sdk": "^2.201.0"
},
"devDependencies": {
"serverless-plugin-typescript": "^1.1.5"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
serverless-plugin-typescript is not in the final release, but typescript and the dependencies of typescript do.
I tried not to include serverless-plugin-typescript plugin in serverless.yml (it's still installed and exist in package.json), the node_modules in zip file will only have aws-sdk and its dependencies.
Typescript 3 supports references:
Does this plugin respect references and include dependencies from depended upon packages in a mono repo?
When I have project-scoped declaration file(*.d.ts
) in my project, packaging with serverless-plugin-typescript
emits compile error like below:
Cannot find name 'TypeInterfaceName'.
(But regardless of the error, packaging is completed successfully and proceed to deployment process.)
So currently I have to write all the declaration files to normal typescript file, and import them to every functions now.
It'd be better to support them :)
I have problems running the sls package
command on a macOS Sierra 10.12.6 (actually the sls deploy
command, but already the packaging is failing). During the execution, first the .serverless
folder and than the .build
folder are created. The problem is, that the .serverless
folder should be part of the .build
folder for the command to execute successfully. I have tested it and if I move the .serverless
folder into the .build
folder and re-run the sls package
command, the packaging succeeds.
$ node --version
v6.11.0
$ npm --version
3.10.10
$ sls version
1.23.0
package.json
"dependencies": {
"aws-sdk": "^2.122.0",
"uuid": "^3.1.0"
},
"devDependencies": {
"@types/node": "^8.0.30",
"serverless-dynamodb-local": "^0.2.25",
"serverless-offline": "^3.16.0",
"serverless-plugin-browserifier": "^1.0.5",
"serverless-plugin-typescript": "^1.1.2"
}
serverless.yml
plugins:
- serverless-plugin-typescript
- serverless-plugin-browserifier
- serverless-dynamodb-local
- serverless-offline
tsconfig.json
{
"compilerOptions": {
"preserveConstEnums": true,
"strictNullChecks": true,
"alwaysStrict": true,
"sourceMap": true,
"target": "es5",
"outDir": ".build",
"moduleResolution": "node",
"lib": ["es2015"],
"rootDir": "./"
}
}
Folder structure
/
.serverless -> 1st generated folder; **ERROR: should be part of the .build folder**
.build -> 2nd generated folder; **ERROR: schould actually include the .serverless folder**
node_modules
entity
get.ts
[...]
serverless.yml
tsconfig.json
package.json
Error
$ sls package
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 dynamodb
Serverless: Load command dynamodb:migrate
Serverless: Load command dynamodb:seed
Serverless: Load command dynamodb:start
Serverless: Load command dynamodb:noStart
Serverless: Load command dynamodb:remove
Serverless: Load command dynamodb:install
Serverless: Load command offline
Serverless: Load command offline:start
Serverless: Invoke package
Serverless: Invoke aws:common:validate
Serverless: Invoke aws:common:cleanupTempDir
Serverless: Compiling with Typescript...
Serverless: Using local tsconfig.json
Serverless: Typescript compiled.
Serverless: Browserifier::validate
Serverless: Browserifier::globalConfig
computed globalBrowserifyConfig { disable: false,
[...]
debug: false }
Serverless: Browserifier: Preparing **entity**_list...
Serverless: Browserifier: Preparing **entity**_create...
Serverless: Browserifier: Preparing **entity**_get...
Serverless: Browserifier: Preparing **entity**_update...
Serverless: Browserifier: Preparing **entity**_delete...
Serverless: Packaging service...
Error --------------------------------------------------
ENOENT: no such file or directory, lstat '/Users/***/***/***/.build/.serverless'
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Stack Trace --------------------------------------------
Error: ENOENT: no such file or directory, lstat '/Users/***/***/***/.build/.serverless'
at Error (native)
From previous event:
at PluginManager.invoke (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:360:22)
at PluginManager.run (/usr/local/lib/node_modules/serverless/lib/classes/PluginManager.js:391:17)
at variables.populateService.then (/usr/local/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 (/usr/local/lib/node_modules/serverless/lib/Serverless.js:86:74)
at serverless.init.then (/usr/local/lib/node_modules/serverless/bin/serverless:39:50)
Package now has an individual
option, and that's also an option for each individual function:
https://serverless.com/framework/docs/providers/aws/guide/packaging#packaging-functions-separately
It would be good to support this as well, so individual functions can be deployed separately.
Hey,
i use some additional fles in my typescript fles (jpgs, templates, fonts) to eg. create pdf files. While testing these files are not added to .build-folder automatically? how can i do this?
best regards
Hello,
I want to build an Alexa Skill using typescript and serverless - which are both quite new for me. The basic code - before I added typescript - was running just fine. But with typescript I got an error:
Using powershell and tried to get more infos with the SLS_DEBUG. It showed me an error for the serverless-plugin-typescript
cmd /c "set `"SLS_DEBUG=*`" & serverless invoke local --verbose -f browserkiosk -p ./testdata/deepSpecificPicture.json "
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 print
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 offline
Serverless: Load command offline:start
Serverless: Invoke invoke:local
Type Error ---------------------------------------------
Cannot read property 'package' of undefined
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Stack Trace --------------------------------------------
TypeError: Cannot read property 'package' of undefined
at TypeScriptPlugin.prepare (C:\GoogleDrive\03_Codes\Alexa\AlexaSkills_ASK-CLI\browserkiosk\lambda\custom\node_modules\serverless-plugin-typescript\dist\src\index.js:70:29)
at TypeScriptPlugin.<anonymous> (C:\GoogleDrive\03_Codes\Alexa\AlexaSkills_ASK-CLI\browserkiosk\lambda\custom\node_modules\serverless-plugin-typescript\dist\src\index.js:104:18)
at Generator.next (<anonymous>)
at C:\GoogleDrive\03_Codes\Alexa\AlexaSkills_ASK-CLI\browserkiosk\lambda\custom\node_modules\serverless-plugin-typescript\dist\src\index.js:7:71
at new Promise (<anonymous>)
at __awaiter (C:\GoogleDrive\03_Codes\Alexa\AlexaSkills_ASK-CLI\browserkiosk\lambda\custom\node_modules\serverless-plugin-typescript\dist\src\index.js:3:12)
at TypeScriptPlugin.compileTs (C:\GoogleDrive\03_Codes\Alexa\AlexaSkills_ASK-CLI\browserkiosk\lambda\custom\node_modules\serverless-plugin-typescript\dist\src\index.js:103:16)
at TypeScriptPlugin.<anonymous> (C:\GoogleDrive\03_Codes\Alexa\AlexaSkills_ASK-CLI\browserkiosk\lambda\custom\node_modules\serverless-plugin-typescript\dist\src\index.js:41:48)
at Generator.next (<anonymous>)
at C:\GoogleDrive\03_Codes\Alexa\AlexaSkills_ASK-CLI\browserkiosk\lambda\custom\node_modules\serverless-plugin-typescript\dist\src\index.js:7:71
at new Promise (<anonymous>)
at __awaiter (C:\GoogleDrive\03_Codes\Alexa\AlexaSkills_ASK-CLI\browserkiosk\lambda\custom\node_modules\serverless-plugin-typescript\dist\src\index.js:3:12)
at Object.before:invoke:local:invoke [as hook] (C:\GoogleDrive\03_Codes\Alexa\AlexaSkills_ASK-CLI\browserkiosk\lambda\custom\node_modules\serverless-plugin-typescript\dist\src\index.js:40:49)
at BbPromise.reduce (C:\Users\jpteb\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:372:55)
From previous event:
at PluginManager.invoke (C:\Users\jpteb\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:372:22) at PluginManager.run (C:\Users\jpteb\AppData\Roaming\npm\node_modules\serverless\lib\classes\PluginManager.js:403:17)
at variables.populateService.then (C:\Users\jpteb\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:102:33)
at runCallback (timers.js:794:20)
at tryOnImmediate (timers.js:752:5)
at processImmediate [as _immediateCallback] (timers.js:729:5)
From previous event:
at Serverless.run (C:\Users\jpteb\AppData\Roaming\npm\node_modules\serverless\lib\Serverless.js:89:74)
at serverless.init.then (C:\Users\jpteb\AppData\Roaming\npm\node_modules\serverless\bin\serverless:42:50)
at <anonymous>
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information -----------------------------
OS: win32
Node Version: 8.10.0
Serverless Version: 1.27.0
My additions on typescript in the serverless.yml
plugins:
- serverless-offline
- serverless-plugin-typescript
My additions in the package.json
"dependencies": {
"ask-sdk": "^2.0.1"
},
"devDependencies": {
"@types/node": "^10.0.2",
"serverless-offline": "^3.20.3",
"serverless-plugin-typescript": "^1.1.5"
},
Does anybody have a clue how to handle this? Didn't I set it up correctly?
When splitting config into different files and referencing them through the following pattern —see below— plugin throws Cannot read property 'split' of undefined
.
...
resources:
- ${file(resources/cognito-user-pool.yml)}
Full stacktrace:
TypeError: Cannot read property 'split' of undefined
at _.values.map.map.h (/Users/glenn/Dev/Freelancing/Haloha/haloha-api/node_modules/serverless-plugin-typescript/src/typescript.ts:53:31)
at Array.map (<anonymous>)
at Object.extractFileNames (/Users/glenn/Dev/Freelancing/Haloha/haloha-api/node_modules/serverless-plugin-typescript/src/typescript.ts:52:6)
at TypeScriptPlugin.get rootFileNames [as rootFileNames] (/Users/glenn/Dev/Freelancing/Haloha/haloha-api/node_modules/serverless-plugin-typescript/src/index.ts:71:23)
at TypeScriptPlugin.<anonymous> (/Users/glenn/Dev/Freelancing/Haloha/haloha-api/node_modules/serverless-plugin-typescript/src/index.ts:132:51)
at Generator.next (<anonymous>)
at /Users/glenn/Dev/Freelancing/Haloha/haloha-api/node_modules/serverless-plugin-typescript/dist/src/index.js:7:71
at new Promise (<anonymous>)
at __awaiter (/Users/glenn/Dev/Freelancing/Haloha/haloha-api/node_modules/serverless-plugin-typescript/dist/src/index.js:3:12)
at TypeScriptPlugin.compileTs (/Users/glenn/Dev/Freelancing/Haloha/haloha-api/node_modules/serverless-plugin-typescript/dist/src/index.js:103:16)
at BbPromise.reduce (/Users/glenn/.nvm/versions/node/v10.8.0/lib/node_modules/serverless/lib/classes/PluginManager.js:390:55)
From previous event:
at PluginManager.invoke (/Users/glenn/.nvm/versions/node/v10.8.0/lib/node_modules/serverless/lib/classes/PluginManager.js:390:22)
at PluginManager.spawn (/Users/glenn/.nvm/versions/node/v10.8.0/lib/node_modules/serverless/lib/classes/PluginManager.js:408:17)
at Deploy.BbPromise.bind.then.then (/Users/glenn/.nvm/versions/node/v10.8.0/lib/node_modules/serverless/lib/plugins/deploy/deploy.js:123:50)
From previous event:
at Object.before:deploy:deploy [as hook] (/Users/glenn/.nvm/versions/node/v10.8.0/lib/node_modules/serverless/lib/plugins/deploy/deploy.js:113:10)
at BbPromise.reduce (/Users/glenn/.nvm/versions/node/v10.8.0/lib/node_modules/serverless/lib/classes/PluginManager.js:390:55)
From previous event:
at PluginManager.invoke (/Users/glenn/.nvm/versions/node/v10.8.0/lib/node_modules/serverless/lib/classes/PluginManager.js:390:22)
at PluginManager.run (/Users/glenn/.nvm/versions/node/v10.8.0/lib/node_modules/serverless/lib/classes/PluginManager.js:421:17)
at variables.populateService.then.then (/Users/glenn/.nvm/versions/node/v10.8.0/lib/node_modules/serverless/lib/Serverless.js:157:33)
at runCallback (timers.js:693:18)
at tryOnImmediate (timers.js:664:5)
at processImmediate (timers.js:646:5)
at process.topLevelDomainCallback (domain.js:121:23)
From previous event:
at Serverless.run (/Users/glenn/.nvm/versions/node/v10.8.0/lib/node_modules/serverless/lib/Serverless.js:144:8)
at serverless.init.then (/Users/glenn/.nvm/versions/node/v10.8.0/lib/node_modules/serverless/bin/serverless:43:50)
I just want say how seamless the serverless offline start
is beautiful, love it.
Unfortunately I can seem to run the serverless package
because of the following issues
#1 https://github.com/prisma/serverless-plugin-typescript/blob/master/src/index.ts#L169-L172 seems to fail for me EVERY time. I know this process works because if i remove the plugin, I can get it to build. Complains about '.build/.serverless' doesn't exist. It seems like the fs-extra copy method only works if the directory already exists. I put a if( !fs.existsSync(pathtobuildserverless) ) fs.mkdirSync(pathtobuildserverless)
#2 even when i do get past this, it complains that .serverless/deployment.zip doesn't exist, this is because I already have an artifact name defined but its in <rootDir>/deployment.zip not <rootDir>/.serverless/deployment.zip. it doesn't seem to recognize paths in the artifact
Unfortunately, in serverless I haven't found a way to turn off plugins depending on command, currently commenting out when I need to do a build.
When running npm install
in a project that depends on serverless-plugin-typescript
, npm throws the following warning:
npm WARN deprecated [email protected]: Use [email protected]+ instead
Thank you for creating and updating this project!
When using the plugin against Serverless 1.15.3
`Serverless: WARNING: Plugin ServerlessPlugin uses deprecated hook before:deploy:createDeploymentArtifacts
Serverless: WARNING: Plugin ServerlessPlugin uses deprecated hook after:deploy:createDeploymentArtifacts`
If there are errors in the typescript, the deploy continues.
I'm using noImplicitAny and getting errors, but the deploy continues.
I created a PR to support serverless run
(#49), but watching for file changes is not working, and I don't know why.
Hi!
I have shared code in my project, e.g. a folder structure like this:
/shared
shared1.ts
shared2.ts
/microservice1
/node_modules
package.json
microservice1.ts
tsconfig.json
serverless.yml
/microservice2
/node_modules
package.json
microservice2.ts
tsconfig.json
serverless.yml
According to what I read it is not possible to pass a YAML file via command line to serverless deploy / offline start. So the current working directory has to be inside "/microservice1" or "/microservice2".
This results in not being able to build with error:
'File '...shared1.ts' is not under 'rootDir' '...microservice1'. 'rootDir' is expected to contain all source files.',
I also can not set rootDir in tsconfig.json to "../" since it is overwritten with default './'. So the only work around I see is to work with symlinks which is IMHO a little hacky.
So is there a possibility to build these shared files?
I love this plugin, however it doesn't work with many other functions that make the serverless framework great, including other plugins, and even native functionality such as invoking the function locally.
Without being able to test locally, this plugin really reduces the benefits of the serverless framework in general.
Hi, I've noticed that when I provide --path
parameter in sls invoke local -f .. -p path/to/event.json
the invocation finishes with error: The file you provided does not exist.
.
I guessed from the code here that I need to add include
option to serverless.yml
file so that event.json gets copied to .build directory: https://github.com/graphcool/serverless-plugin-typescript/blob/4bace79c1dd25cfb416cb7a4e4cc019c86fec309/src/index.ts#L149:L152
like so:
package:
include:
- src/**/event.json
However, any changes to event.json are not being updated when I do a new lambda invocation.
So I wonder if the --path paramter isn't working so far or am I doing it wrong?
Hi,
Serverless commands throws Cannot read property 'replace' of undefined when using the extend
property with local file eg. "extends": "../../tsconfig.settings.json",
Can be reproduced with the following file.
{
"extends": "../../tsconfig.settings.json",
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"lib": [ "es6", "dom" ],
"moduleResolution": "node",
"rootDir": "./src",
"outDir": ".build",
"sourceMap": true,
"allowJs": true,
"noImplicitAny": true,
"noUnusedLocals": true,
"noImplicitThis": true,
"strictNullChecks": true,
"noImplicitReturns": true,
"preserveConstEnums": true,
"suppressImplicitAnyIndexErrors": true,
"forceConsistentCasingInFileNames": true
},
"exclude": [
"node_modules",
"build",
],
"types": [ "typePatches" ]
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.