aws-samples / aws-samples/serverless-typescript-demo

Project is Currently broken when attempting to build locally

Open
#24 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
150
Forks
41
PR merge metrics
No merged PRs in 30d

Description

The project will fail when running `npm install`, upgrading the versions of the dependencies will resolve this.

The after dependecies are installed, the project will fail to build with the following error:

```
npm run build

> serverless-typescript-demo@0.1.0 build
> tsc

src/api/delete-product.ts:45:91 - error TS2345: Argument of type '[unknown]' is not assignable to parameter of type 'LogItemExtraInput'.
Type '[unknown]' is not assignable to type '[string | Error]'.
Type 'unknown' is not assignable to type 'string | Error'.

45 logger.error('Unexpected error occurred while trying to delete product with ID '+ id, error);
~~~~~

src/api/get-product.ts:54:82 - error TS2345: Argument of type '[unknown]' is not assignable to parameter of type 'LogItemExtraInput'.
Type '[unknown]' is not assignable to type '[string | Error]'.
Type 'unknown' is not assignable to type 'string | Error'.

54 logger.error('Unexpected error occurred while trying to retrieve a product', error);
~~~~~

src/api/put-product.ts:4:25 - error TS2307: Cannot find module '../model/product' or its corresponding type declarations.

4 import { Product } from "../model/product";
~~~~~~~~~~~~~~~~~~

src/api/put-product.ts:51:80 - error TS2345: Argument of type '[unknown]' is not assignable to parameter of type 'LogItemExtraInput'.
Type '[unknown]' is not assignable to type '[string | Error]'.
Type 'unknown' is not assignable to type 'string | Error'.

51 logger.error('Unexpected error occurred while trying to create a product', error);
~~~~~

src/api/put-product.ts:86:80 - error TS2345: Argument of type '[unknown]' is not assignable to parameter of type 'LogItemExtraInput'.
Type '[unknown]' is not assignable to type '[string | Error]'.
Type 'unknown' is not assignable to type 'string | Error'.

86 logger.error('Unexpected error occurred while trying to create a product', error);
~~~~~

src/store/product-store.ts:3:25 - error TS2307: Cannot find module '../model/product' or its corresponding type declarations.

3 import { Product } from "../model/product";
~~~~~~~~~~~~~~~~~~

Found 6 errors in 4 files.

Errors Files
1 src/api/delete-product.ts:45
1 src/api/get-product.ts:54
3 src/api/put-product.ts:4
1 src/store/product-store.ts:3
```

Contributor guide

Open the contributing guide

Research direction

Run npm install and npm run build first, then use the compiler output to inspect src/api/delete-product.ts, src/api/get-product.ts, src/api/put-product.ts, and src/store/product-store.ts. Check the dependency versions and the missing ../model/product imports alongside the logger.error type errors. Done means npm install completes and npm run build finishes without TypeScript errors.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend, build-system
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.