`
sillycat
  • 浏览: 2539511 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

TypeScript and Serverless Memory Issue

 
阅读更多
TypeScript and Serverless Memory Issue

Change the file to add the follow codes at the top
/opt/node/lib/node_modules/serverless/bin/serverless

#!/usr/bin/env node --max-old-space-size=3000 --trace-gc-verbose

JavaScript heap out of memory error.

It fails as well
  Serverless Error ---------------------------------------

  An error occurred: DevicePairingUpdatesLambdaFunction - Unzipped size must be smaller than 262144000 bytes (Service: AWSLambda; Status Code: 400; Error Code: InvalidParameterValueException; Request ID: 94dddcf0-b153-11e8-81e6-771d442f6caf).

>  node --version && sls --version
v8.10.0
1.30.0

It is claimed that after serverless 1.16.0, the dev dependencies are excluded.
https://github.com/serverless/serverless/releases/tag/v1.16.0

Once thing I notices in my case is that, I have a large js and map.js. I do not have node_modules.

Upgrade the NPM
> sudo npm i -g npm

Upgrade my serverless
> sudo npm i -g serverless

Follow command will generate a zip file in .serverless directory, we can check the size of the package there
> sls package

Check out version
> npm info @lifesize/tscommon version
0.1.20

I did the npm cache clean, but I still did not get the latest version
> npm cache clean --force
npm WARN using --force I sure hope you know what you are doing.


The NPM package things may related to our deployment and CircleCI
Follow this
https://docs.npmjs.com/getting-started/publishing-npm-packages

We need run
npm version patch and npm publish

In my current case, I only need to run
npm version patch and push that to GitHub.com and then
In the release page on GitHub.com like https://github.com/sillycat/projectName/releases —> “Draft a new release"

Or we can do tag as well.
https://stackoverflow.com/questions/18216991/create-a-tag-in-github-repository
>git tag -a v1.1.1 -m “description of this tag”
>git push - - tags

List all the tags
>git tag

The project size is related to webpack and npm local package.

References:
https://www.jeremydaly.com/how-to-optimize-the-serverless-optimizer-plugin/
http://www.goingserverless.com/blog/keeping-dev-dependencies-out-of-your-serverless-package
https://github.com/serverless/serverless/releases/tag/v1.16.0



分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics