serverless-analytics icon indicating copy to clipboard operation
serverless-analytics copied to clipboard

Cannot find names ['LambdaHTTPEvent', 'DynamoDBItem'] during deployment

Open mcat-ee opened this issue 7 years ago • 4 comments

I'm getting the following issues during deployment:

$ serverless deploy
Serverless: Configure DynamoDB Auto Scaling …
Serverless:  - Building configuration for resource "table/DynamoDBTable"
Serverless: Added DynamoDB Auto Scaling to CloudFormation!
Serverless: Compiling with Typescript...
Serverless: Using local tsconfig.json
src/api/ranking.ts (5,24): Cannot find name 'LambdaHttpEvent'.
src/api/ranking.ts (27,12): Cannot find name 'DynamoDBItem'.
src/api/ranking.ts (28,11): Cannot find name 'DynamoDBItem'.
src/api/ranking.ts (28,28): Cannot find name 'DynamoDBItem'.
src/api/ranking.ts (31,12): Cannot find name 'DynamoDBItem'.
src/api/ranking.ts (32,14): Cannot find name 'DynamoDBItem'.
src/api/ranking.ts (39,12): Cannot find name 'RankingItem'.
src/api/series.ts (6,24): Cannot find name 'LambdaHttpEvent'.
src/api/series.ts (33,12): Cannot find name 'DynamoDBItem'.
src/api/series.ts (34,11): Cannot find name 'DynamoDBItem'.
src/api/series.ts (34,28): Cannot find name 'DynamoDBItem'.
src/api/series.ts (37,12): Cannot find name 'DynamoDBItem'.
src/api/series.ts (38,14): Cannot find name 'DynamoDBItem'.
src/api/series.ts (45,12): Cannot find name 'SeriesItem'.
src/process.ts (31,23): Cannot find name 'EventData'.
src/process.ts (56,28): Cannot find name 'KinesisEvent'.
src/process.ts (61,12): Cannot find name 'KinesisItem'.
Serverless: Packaging service...
Serverless: Excluding development dependencies...

I had some earlier issues with Brew and jq (Brew was an older version and jq wasn't installed) - but they appear to be sorted now.

I changed the service name and tried to re-deploy but I received the same errors :(

What should I try next?

edit: I'm running OSX 13.3

I've ran the commands included in the README.md file and npm install

mcat-ee avatar Feb 26 '18 10:02 mcat-ee

Those are just typescript warnings for missing typings, it doesn't affect the actual build.

I just did a clean run on OSX, seems like there's some things that are not documented.

  • deploy script is using library called jq. You can install it by running brew install jq (if you have Homebrew installed) or download it here https://stedolan.github.io/jq/download/
  • That same script is using s3sync-cli to upload files to S3. That tool requires AWS_ACCESS_KEY and AWS_SECRET_KEY environmental variables to be set.

After these changes I got this project app deployed.

artoliukkonen avatar Feb 26 '18 16:02 artoliukkonen

One more thing; analytics dashboard example is hardcoded to load analytics from 2017. That's why you probably see empty analytics unless you fix that manually.

artoliukkonen avatar Feb 26 '18 16:02 artoliukkonen

Okay I've installed s3sync-cli and set my AWS credentials... but now i'm getting the following errors:

opts:	".serverless/output.json"
output:	"dist/website/index.html"
opts:	".serverless/output.json"
output:	"dist/dashboard/index.html"

Sync `dist` folder with S3 …

index.html -> https://s3.amazonaws.com/************/index.html
Error: Bad status code: 307
    at /Users/****/serverless-analytics/node_modules/s3-sync/index.js:129:17
    at wrappedFn (/Users/***/serverless-analytics/node_modules/knox/lib/client.js:409:9)
    at ClientRequest.onResponse (/Users/****/serverless-analytics/node_modules/knox/lib/client.js:60:7)
    at emitOne (events.js:115:13)
    at ClientRequest.emit (events.js:210:7)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:565:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:116:23)
    at TLSSocket.socketOnData (_http_client.js:454:20)
    at emitOne (events.js:115:13)
    at TLSSocket.emit (events.js:210:7)
index.html -> https://s3.amazonaws.com/*****************/index.html
Error: Bad status code: 307
    at /Users/***/serverless-analytics/node_modules/s3-sync/index.js:129:17
    at wrappedFn (/Users/****/serverless-analytics/node_modules/knox/lib/client.js:409:9)
    at ClientRequest.onResponse (/Users/****/serverless-analytics/node_modules/knox/lib/client.js:60:7)
    at emitOne (events.js:115:13)
    at ClientRequest.emit (events.js:210:7)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:565:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:116:23)
    at TLSSocket.socketOnData (_http_client.js:454:20)
    at emitOne (events.js:115:13)
    at TLSSocket.emit (events.js:210:7)

Dashboard: http://**********.s3-website-ap-southeast-2.amazonaws.com/
Website: http://************.s3-website-ap-southeast-2.amazonaws.com/

and when I navigate to the site I get this: image

I'll investigate properly after work but any further help you can provide would be excellent.

Thank you so much for your help thus far!!!!!!

mcat-ee avatar Feb 27 '18 02:02 mcat-ee

Okay I've installed s3sync-cli and set my AWS credentials... but now i'm getting the following errors:

opts:	".serverless/output.json"
output:	"dist/website/index.html"
opts:	".serverless/output.json"
output:	"dist/dashboard/index.html"

Sync `dist` folder with S3 …

index.html -> https://s3.amazonaws.com/************/index.html
Error: Bad status code: 307
    at /Users/****/serverless-analytics/node_modules/s3-sync/index.js:129:17
    at wrappedFn (/Users/***/serverless-analytics/node_modules/knox/lib/client.js:409:9)
    at ClientRequest.onResponse (/Users/****/serverless-analytics/node_modules/knox/lib/client.js:60:7)
    at emitOne (events.js:115:13)
    at ClientRequest.emit (events.js:210:7)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:565:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:116:23)
    at TLSSocket.socketOnData (_http_client.js:454:20)
    at emitOne (events.js:115:13)
    at TLSSocket.emit (events.js:210:7)
index.html -> https://s3.amazonaws.com/*****************/index.html
Error: Bad status code: 307
    at /Users/***/serverless-analytics/node_modules/s3-sync/index.js:129:17
    at wrappedFn (/Users/****/serverless-analytics/node_modules/knox/lib/client.js:409:9)
    at ClientRequest.onResponse (/Users/****/serverless-analytics/node_modules/knox/lib/client.js:60:7)
    at emitOne (events.js:115:13)
    at ClientRequest.emit (events.js:210:7)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:565:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:116:23)
    at TLSSocket.socketOnData (_http_client.js:454:20)
    at emitOne (events.js:115:13)
    at TLSSocket.emit (events.js:210:7)

Dashboard: http://**********.s3-website-ap-southeast-2.amazonaws.com/
Website: http://************.s3-website-ap-southeast-2.amazonaws.com/

and when I navigate to the site I get this: image

I'll investigate properly after work but any further help you can provide would be excellent.

Thank you so much for your help thus far!!!!!!

open html files in local to test, its work , try to change de client side.

issnoe avatar Feb 14 '19 08:02 issnoe