-
Notifications
You must be signed in to change notification settings - Fork 227
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #271 Skip Non-NodeJS Functions #277
Conversation
@medikoo Could you please review this PR? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @sazzy4o ! Please see my comments
package.json
Outdated
@@ -53,13 +53,13 @@ | |||
"@types/jest": "24.0.12", | |||
"@types/lodash": "4.14.123", | |||
"@types/node": "12.6.2", | |||
"jest": "24.5.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it required to upgrade jest
?
I feel it's a breaking change for the suite, as in current major support for Node.js v10 must be maintained and we should be able to run tests with that version
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, seems like the latest version of jest
doesn't support Node.js v10. I rolled back to old version and tested with v10. There is just a warning that typescript version is not officially supported:
ts-jest[versions] (WARN) Version 4.7.4 of typescript installed has not been tested with ts-jest. If you're experiencing issues, consider using a supported version (>=2.7.0 <4.0.0). Please do not report issues in ts-jest if you are using unsupported versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, in case you were wondering why typescript
was updated. It does not compile with 3.9.*
:
node_modules/@sinclair/typebox/typebox.d.ts:66:102 - error TS2574: A rest element type must be an array type.
66 export declare type StaticContructorParameters<T extends readonly TSchema[], P extends unknown[]> = [...{
~~~~
67 [K in keyof T]: T[K] extends TSchema ? Static<T[K], P> : never;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
68 }];
~
node_modules/@sinclair/typebox/typebox.d.ts:87:100 - error TS2574: A rest element type must be an array type.
87 export declare type StaticFunctionParameters<T extends readonly TSchema[], P extends unknown[]> = [...{
~~~~
88 [K in keyof T]: T[K] extends TSchema ? Static<T[K], P> : never;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
89 }];
~
node_modules/@sinclair/typebox/typebox.d.ts:105:21 - error TS2456: Type alias 'IntersectReduce' circularly references itself.
105 export declare type IntersectReduce<I extends unknown, T extends readonly any[]> = T extends [infer A, ...infer B] ? IntersectReduce<I & A, B> : I extends object ? I : {};
~~~~~~~~~~~~~~~
node_modules/@sinclair/typebox/typebox.d.ts:105:104 - error TS2574: A rest element type must be an array type.
105 export declare type IntersectReduce<I extends unknown, T extends readonly any[]> = T extends [infer A, ...infer B] ? IntersectReduce<I & A, B> : I extends object ? I : {};
~~~~~~~~~~
node_modules/@sinclair/typebox/typebox.d.ts:105:118 - error TS2315: Type 'IntersectReduce' is not generic.
105 export declare type IntersectReduce<I extends unknown, T extends readonly any[]> = T extends [infer A, ...infer B] ? IntersectReduce<I & A, B> : I extends object ? I : {};
...
src/index.ts
Outdated
.reduce((obj, key) => { | ||
obj[key] = functions[key] | ||
return obj | ||
}, {}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not user reduce for that. It'll be clearer to setup loop as follows:
const nodeFunctions = {};
for (const [name, functionObject] of Object.entries(functions)) {
if (nodeRuntime) nodeFunctions[name] = functionObject;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, I refactored the logic
@medikoo Thanks for the review! I have made some changes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @sazzy4o 👍
I'm getting the following error
I think when specifying packaging individually option we reach this line and it doesn't seem to include the fix |
@avivshafir Could you please share your serverless.yml and your package-lock.json (so, I can check your commit hash/version) Get |
https://gist.github.com/avivshafir/b984c80879938c44a77dc907e72bc374 running version 2.1.4 of serverless-plugin-typescript |
Seems like it's happening only when I'm setting the python lambda to use an image parameter |
I haven't had time to properly test yet, but you can try this fix: (I should have some time to test and create a PR over the next few days) |
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: