TypeScript and Serverless Memory Issue

299 篇文章 0 订阅
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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值