@@ -15,8 +15,8 @@ import { Logger } from "../logger.js";
1515 * Support for AWS SAM framework
1616 */
1717export class SamFramework implements IFramework {
18- protected samConfigFile = path . resolve ( "samconfig.toml" ) ;
19- protected samTemplateFile = path . resolve ( "template.yaml" ) ;
18+ protected samConfigFile = "samconfig.toml" ;
19+ protected samTemplateFile = "template.yaml" ;
2020
2121 /**
2222 * Framework name
@@ -31,19 +31,19 @@ export class SamFramework implements IFramework {
3131 */
3232 public async canHandle ( ) : Promise < boolean > {
3333 try {
34- await fs . access ( this . samConfigFile , constants . F_OK ) ;
34+ await fs . access ( path . resolve ( this . samConfigFile ) , constants . F_OK ) ;
3535 } catch ( error ) {
3636 Logger . verbose (
37- `[SAM] This is not a SAM framework project. ${ this . samConfigFile } not found.`
37+ `[SAM] This is not a SAM framework project. ${ path . resolve ( this . samConfigFile ) } not found.`
3838 ) ;
3939 return false ;
4040 }
4141
4242 try {
43- await fs . access ( this . samTemplateFile , constants . F_OK ) ;
43+ await fs . access ( path . resolve ( this . samTemplateFile ) , constants . F_OK ) ;
4444 } catch ( error ) {
4545 Logger . verbose (
46- `[SAM] This is not a SAM framework project. ${ this . samTemplateFile } not found.`
46+ `[SAM] This is not a SAM framework project. ${ path . resolve ( this . samTemplateFile ) } not found.`
4747 ) ;
4848 return false ;
4949 }
@@ -65,16 +65,24 @@ export class SamFramework implements IFramework {
6565
6666 const environment = config . configEnv ?? "default" ;
6767
68- const samConfigContent = await fs . readFile ( this . samConfigFile , "utf-8" ) ;
68+ const samConfigContent = await fs . readFile (
69+ path . resolve ( this . samConfigFile ) ,
70+ "utf-8"
71+ ) ;
6972
7073 const samConfig = toml . parse ( samConfigContent ) ;
7174 const stackName = samConfig [ environment ] ?. global ?. parameters ?. stack_name ;
7275
7376 if ( ! stackName ) {
74- throw new Error ( `Stack name not found in ${ this . samConfigFile } ` ) ;
77+ throw new Error (
78+ `Stack name not found in ${ path . resolve ( this . samConfigFile ) } `
79+ ) ;
7580 }
7681
77- const samTemplateContent = await fs . readFile ( this . samTemplateFile , "utf-8" ) ;
82+ const samTemplateContent = await fs . readFile (
83+ path . resolve ( this . samTemplateFile ) ,
84+ "utf-8"
85+ ) ;
7886 const template = yaml . parse ( samTemplateContent ) ;
7987
8088 const lambdas : any [ ] = [ ] ;
0 commit comments