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 {
167167
168168 if ( ! codePath ) {
169169 const fileWithExtension = handlerParts [ 0 ] ;
170+ const possibleCodePathsTs = `${ fileWithExtension } .ts` ;
171+ const possibleCodePathsJs = `${ fileWithExtension } .js` ;
170172 const possibleCodePaths = [
171- ` ${ fileWithExtension } .ts` ,
172- ` ${ fileWithExtension } .js` ,
173+ possibleCodePathsTs ,
174+ possibleCodePathsJs ,
173175 `${ fileWithExtension } .cjs` ,
174176 `${ fileWithExtension } .mjs` ,
175177 ] ;
@@ -183,10 +185,14 @@ export class SamFramework implements IFramework {
183185 // ignore, file not found
184186 }
185187 }
186- }
187188
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+ }
190196 }
191197
192198 const packageJsonPath = await findPackageJson ( codePath ) ;
You can’t perform that action at this time.
0 commit comments