serverless / serverless-plugin-typescript

Serverless plugin for zero-config Typescript support
MIT License
781 stars 222 forks source link

Fix #271 Skip Non-NodeJS Functions #277

Closed sazzy4o closed 1 year ago

sazzy4o commented 1 year ago

This plugin currently breaks your serverless stack if you have any non-nodejs functions (Python, Java, etc.) also in it. This skips them This is based on this old PR: #197 (Merge conflicts and some unnecessary changes) This closes #271

Change summary:

sazzy4o commented 1 year ago

@medikoo Could you please review this PR? (Sorry, if this is not the right way to request a review)

sazzy4o commented 1 year ago

@medikoo Thanks for the review! I have made some changes

avivshafir commented 1 year ago

I'm getting the following error

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined

I think when specifying packaging individually option we reach this line https://github.com/serverless/serverless-plugin-typescript/blob/master/src/index.ts#L281

and it doesn't seem to include the fix

sazzy4o commented 1 year ago

@avivshafir Could you please share your serverless.yml and your package-lock.json (so, I can check your commit hash/version) Edit: It was released in 2.1.3, so make sure you are running that version or newer (or installing from GitHub)

Get getAllFunctions accesses this.functions which does have the fix (but, maybe there is something else I missed) https://github.com/serverless/serverless/blob/9a414683090cb3edcac61d9a782c4d136f18c6f6/lib/classes/service.js#L305

avivshafir commented 1 year ago

@sazzy4o

https://gist.github.com/avivshafir/b984c80879938c44a77dc907e72bc374

running version 2.1.4 of serverless-plugin-typescript and serverless version 3.23.0

avivshafir commented 1 year ago

Seems like it's happening only when I'm setting the python lambda to use an image parameter

sazzy4o commented 1 year ago

I haven't had time to properly test yet, but you can try this fix:

https://github.com/sazzy4o/serverless-plugin-typescript/commit/b9d3ae40845d4e1a13e3de9fe289e0d2f14011d6

(I should have some time to test and create a PR over the next few days)