File tree Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Expand file tree Collapse file tree 1 file changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -167,9 +167,11 @@ export class SamFramework implements IFramework {
167
167
168
168
if ( ! codePath ) {
169
169
const fileWithExtension = handlerParts [ 0 ] ;
170
+ const possibleCodePathsTs = `${ fileWithExtension } .ts` ;
171
+ const possibleCodePathsJs = `${ fileWithExtension } .js` ;
170
172
const possibleCodePaths = [
171
- ` ${ fileWithExtension } .ts` ,
172
- ` ${ fileWithExtension } .js` ,
173
+ possibleCodePathsTs ,
174
+ possibleCodePathsJs ,
173
175
`${ fileWithExtension } .cjs` ,
174
176
`${ fileWithExtension } .mjs` ,
175
177
] ;
@@ -183,10 +185,14 @@ export class SamFramework implements IFramework {
183
185
// ignore, file not found
184
186
}
185
187
}
186
- }
187
188
188
- if ( ! codePath ) {
189
- throw new Error ( `Code path not found for function: ${ func . Name } ` ) ;
189
+ if ( ! codePath ) {
190
+ codePath = possibleCodePathsJs ;
191
+
192
+ Logger . warn (
193
+ `[Function ${ functionName } ] Can not find code path for handler: ${ handlerFull } . Using fallback: ${ codePath } ` ,
194
+ ) ;
195
+ }
190
196
}
191
197
192
198
const packageJsonPath = await findPackageJson ( codePath ) ;
You can’t perform that action at this time.
0 commit comments