https://serverless-stack.com/ logo
#guide
Title
# guide
m

manitej

05/25/2022, 3:12 AM
The demo notes app is also updated to V1, check it out: https://github.com/serverless-stack/demo-notes-app
r

Rudi

05/26/2022, 10:37 PM
@manitej Hi, I'm starting the guide from scratch - looks like the JS version, though I do see a vitest.config.ts file. The initial deploy works OK, but I do see console warnings|errors like this:
Copy code
/home/rudi/projects/notes/node_modules/esbuild/lib/main.d.ts (467,76): Cannot find name 'Promise'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
465. export declare function build(options: BuildOptions & { incremental: true }): Promise<BuildIncremental>;
466. export declare function build(options: BuildOptions & { metafile: true }): Promise<BuildResult & { metafile: Metafile }>;
467. export declare function build(options: BuildOptions): Promise<BuildResult>;

/home/rudi/projects/notes/node_modules/esbuild/lib/main.d.ts (468,55): Cannot find name 'Promise'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
466. export declare function build(options: BuildOptions & { metafile: true }): Promise<BuildResult & { metafile: Metafile }>;
467. export declare function build(options: BuildOptions): Promise<BuildResult>;
468. 

/home/rudi/projects/notes/node_modules/esbuild/lib/main.d.ts (479,88): Cannot find name 'Promise'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
477.  */
478. export declare function serve(serveOptions: ServeOptions, buildOptions: BuildOptions): Promise<ServeResult>;
479. 

/home/rudi/projects/notes/node_modules/esbuild/lib/main.d.ts (492,79): Cannot find name 'Promise'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
490.  */
491. export declare function transform(input: string, options?: TransformOptions): Promise<TransformResult>;
492. 

/home/rudi/projects/notes/node_modules/esbuild/lib/main.d.ts (502,101): Cannot find name 'Promise'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
500.  */
501. export declare function formatMessages(messages: PartialMessage[], options: FormatMessagesOptions): Promise<string[]>;
502. 

/home/rudi/projects/notes/node_modules/esbuild/lib/main.d.ts (514,105): Cannot find name 'Promise'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
512.  */
513. export declare function analyzeMetafile(metafile: Metafile | string, options?: AnalyzeMetafileOptions): Promise<string>;
514. 

/home/rudi/projects/notes/node_modules/esbuild/lib/main.d.ts (565,65): Cannot find name 'Promise'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
563.  */
564. export declare function initialize(options: InitializeOptions): Promise<void>;
565. 

/home/rudi/projects/notes/node_modules/esbuild/lib/main.d.ts (582,16): Cannot find namespace 'WebAssembly'.
580.    */
581.   wasmModule?: WebAssembly.Module
582. 
Deploying stacks
Checking deploy status...
rudijs-notes-MyStack | CREATE_IN_PROGRESS | AWS::CloudFormation::Stack | rudijs-notes-MyStack | User Initiated
Did not see these when deploying previously (yesterday)
Copy code
~/p/notes ❯❯❯ ./node_modules/.bin/sst --version
SST: 1.2.9
CDK: 2.24.0
Copy code
node -v
v14.15.4
Will try v16 now .. moment
Same|similar with v16 .. pages and pages of stuff like:
Copy code
/home/rudi/projects/notes/node_modules/aws-cdk-lib/aws-medialive/lib/medialive.generated.d.ts (932,27): Cannot find name 'Array'.                                                                            
930.          */                                                                                                                                                                                             
931.         readonly tracks?: Array<CfnChannel.AudioTrackProperty | cdk.IResolvable> | cdk.IResolvable;                                                                                                     
932.     }                                                                                                                                                                                                   
                                                                                                                                                                                                             
/home/rudi/projects/notes/node_modules/aws-cdk-lib/aws-medialive/lib/medialive.generated.d.ts (978,39): Cannot find name 'Array'.                                                                            
976.          */                                                                                                                                                                                             
977.         readonly failoverConditions?: Array<CfnChannel.FailoverConditionProperty | cdk.IResolvable> | cdk.IResolvable;                                                                                  
978.         /**                                                                                                                                                                                             
                                                                                                                                                                                                             
/home/rudi/projects/notes/node_modules/aws-cdk-lib/aws-medialive/lib/medialive.generated.d.ts (2052,38): Cannot find name 'Array'.                                                                           
2050.          */                                                                                                                                                                                            
2051.         readonly audioDescriptions?: Array<CfnChannel.AudioDescriptionProperty | cdk.IResolvable> | cdk.IResolvable;                                                                                   
2052.         /**                                                                                                                                                                                            
                                                                                                                                                                                                             
/home/rudi/projects/notes/node_modules/aws-cdk-lib/aws-medialive/lib/medialive.generated.d.ts (2076,40): Cannot find name 'Array'.                                                                           
2074.          */                                                                                                                                                                                            
2075.         readonly captionDescriptions?: Array<CfnChannel.CaptionDescriptionProperty | cdk.IResolvable> | cdk.IResolvable;                                                                               
2076.         /**                                                                                                                                                                                            
                                                                                                                                                                                                             
/home/rudi/projects/notes/node_modules/aws-cdk-lib/aws-medialive/lib/medialive.generated.d.ts (2106,33): Cannot find name 'Array'.                                                                           
2104.          */                                                                                                                                                                                            
2105.         readonly outputGroups?: Array<CfnChannel.OutputGroupProperty | cdk.IResolvable> | cdk.IResolvable;                                                                                             
2106.         /**
...
Copy code
/home/rudi/projects/notes/node_modules/esbuild/lib/main.d.ts (492,79): Cannot find name 'Promise'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
490.  */
491. export declare function transform(input: string, options?: TransformOptions): Promise<TransformResult>;
492. 

/home/rudi/projects/notes/node_modules/esbuild/lib/main.d.ts (502,101): Cannot find name 'Promise'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
500.  */
501. export declare function formatMessages(messages: PartialMessage[], options: FormatMessagesOptions): Promise<string[]>;
502. 

/home/rudi/projects/notes/node_modules/esbuild/lib/main.d.ts (514,105): Cannot find name 'Promise'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
512.  */
513. export declare function analyzeMetafile(metafile: Metafile | string, options?: AnalyzeMetafileOptions): Promise<string>;
514. 

/home/rudi/projects/notes/node_modules/esbuild/lib/main.d.ts (565,65): Cannot find name 'Promise'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
563.  */
564. export declare function initialize(options: InitializeOptions): Promise<void>;
565. 

/home/rudi/projects/notes/node_modules/esbuild/lib/main.d.ts (582,16): Cannot find namespace 'WebAssembly'.
580.    */
581.   wasmModule?: WebAssembly.Module
582. 
Deploying stacks
Seems to deploy OK, but all those warnings are a bit scary . my tmux terminal could not scroll up enough to see them all
There is also a small mismatch in the docs and the initial code generated:
Copy code
import { Api } from "@serverless-stack/resources";

export function MyStack({ stack }) {
  new Api(stack, "api", {
    routes: {
      "GET /": "functions/lambda.handler",
    },
  });
}
the output is missing from the code generated:
Copy code
// Show the endpoint in the output
  stack.addOutputs({
    ApiEndpoint: api.url,
  });
so you can just click the endpoint from the command line console output. No worry for me, but a beginner might get lost.
When making the code update, redeploy looks like:
Copy code
/home/rudi/projects/notes/node_modules/esbuild/lib/main.d.ts (502,101): Cannot find name 'Promise'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
500.  */
501. export declare function formatMessages(messages: PartialMessage[], options: FormatMessagesOptions): Promise<string[]>;
502. 
/home/rudi/projects/notes/node_modules/esbuild/lib/main.d.ts (514,105): Cannot find name 'Promise'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
512.  */
513. export declare function analyzeMetafile(metafile: Metafile | string, options?: AnalyzeMetafileOptions): Promise<string>;
514. 
/home/rudi/projects/notes/node_modules/esbuild/lib/main.d.ts (565,65): Cannot find name 'Promise'. Do you need to change your target library? Try changing the 'lib' compiler option to 'es2015' or later.
563.  */
564. export declare function initialize(options: InitializeOptions): Promise<void>;
565. 
/home/rudi/projects/notes/node_modules/esbuild/lib/main.d.ts (582,16): Cannot find namespace 'WebAssembly'.
580.    */
581.   wasmModule?: WebAssembly.Module
582. 

Stacks: There are new infrastructure changes. Press ENTER to redeploy.
As you can see the output is not a clean redeploy prompt, 00's of lines of warnings.
I'm not sure how to fix, so I'll just report what I see.
There's also a missing default .gitignore generated, so new users will commit the .build/ etc if they are unaware
The default README is not generated like the previous guide - not sure if you wanted that or not.