midwayjs / midway-faas

🔱 A simple and lightweight serverless framework
MIT License
389 stars 40 forks source link

Cannot read property 'objectMode' of undefined #29

Closed idrex closed 4 years ago

idrex commented 4 years ago

按照官方文档进行安装,会报这个错 Your Environment Information --------------------------- Operating System: darwin Node Version: 12.14.0 Framework Version: 1.62.0 Plugin Version: 3.3.0 SDK Version: 2.3.0 Components Core Version: 1.1.2 Components CLI Version: 1.4.0

czy88840616 commented 4 years ago

不是很明白,这个是在 npm install 的时候报的错?

idrex commented 4 years ago

Serverless: Load plugin Serverless: - aliyun plugin (743ms) Serverless: - default plugin (2319ms) Serverless: deploy Serverless: Package initialize Serverless: - File copy complete (17ms) Serverless: - layers install complete (1ms) Serverless: - Dep install complete (4019ms) Serverless: Building Midway FaaS directory files... Serverless: - Using tradition build mode Serverless: - Build Midway FaaS complete (3486ms) Serverless: Start deploy by @alicloud/fun using region: cn-beijing using accountId: 5876 using accessKeyId: XxAj using timeout: 60

Waiting for service demo-faas to be deployed... Waiting for function demo-faas-dev-index to be deployed... Waiting for packaging function demo-faas-dev-index code...

Type Error ---------------------------------------------

TypeError: Cannot read property 'objectMode' of undefined at WriteStream.Writable.write (_stream_writable.js:281:24) at Archiver.ondata (/Users/drex/Demo/demo-faas/node_modules/_readable-stream@2.3.7@readable-stream/lib/_stream_readable.js:619:20) at Archiver.emit (events.js:210:5) at Archiver.EventEmitter.emit (domain.js:475:20) at addChunk (/Users/drex/Demo/demo-faas/node_modules/_readable-stream@2.3.7@readable-stream/lib/_stream_readable.js:291:12) at readableAddChunk (/Users/drex/Demo/demo-faas/node_modules/_readable-stream@2.3.7@readable-stream/lib/_stream_readable.js:278:11) at Archiver.Readable.push (/Users/drex/Demo/demo-faas/node_modules/_readable-stream@2.3.7@readable-stream/lib/_stream_readable.js:245:10) at Archiver.Transform.push (/Users/drex/Demo/demo-faas/node_modules/_readable-stream@2.3.7@readable-stream/lib/_stream_transform.js:148:32) at Archiver.afterTransform (/Users/drex/Demo/demo-faas/node_modules/_readable-stream@2.3.7@readable-stream/lib/_stream_transform.js:91:10) at Archiver._transform (/Users/drex/Demo/demo-faas/node_modules/_archiver@2.1.1@archiver/lib/core.js:474:3) at Archiver.Transform._read (/Users/drex/Demo/demo-faas/node_modules/_readable-stream@2.3.7@readable-stream/lib/_stream_transform.js:184:10) at Archiver.Transform._write (/Users/drex/Demo/demo-faas/node_modules/_readable-stream@2.3.7@readable-stream/lib/_stream_transform.js:172:83) at doWrite (/Users/drex/Demo/demo-faas/node_modules/_readable-stream@2.3.7@readable-stream/lib/_stream_writable.js:428:64) at writeOrBuffer (/Users/drex/Demo/demo-faas/node_modules/_readable-stream@2.3.7@readable-stream/lib/_stream_writable.js:417:5) at Archiver.Writable.write (/Users/drex/Demo/demo-faas/node_modules/_readable-stream@2.3.7@readable-stream/lib/_stream_writable.js:334:11) at module.exports.ondata (/Users/drex/Demo/demo-faas/node_modules/_readable-stream@2.3.7@readable-stream/lib/_stream_readable.js:619:20) at module.exports.emit (events.js:210:5) at module.exports.EventEmitter.emit (domain.js:475:20) at addChunk (/Users/drex/Demo/demo-faas/node_modules/_readable-stream@2.3.7@readable-stream/lib/_stream_readable.js:291:12) at readableAddChunk (/Users/drex/Demo/demo-faas/node_modules/_readable-stream@2.3.7@readable-stream/lib/_stream_readable.js:278:11) at module.exports.Readable.push (/Users/drex/Demo/demo-faas/node_modules/_readable-stream@2.3.7@readable-stream/lib/_stream_readable.js:245:10) at module.exports.Transform.push (/Users/drex/Demo/demo-faas/node_modules/_readable-stream@2.3.7@readable-stream/lib/_stream_transform.js:148:32) at module.exports.afterTransform (/Users/drex/Demo/demo-faas/node_modules/_readable-stream@2.3.7@readable-stream/lib/_stream_transform.js:91:10) at module.exports.ArchiveOutputStream._transform (/Users/drex/Demo/demo-faas/node_modules/_compress-commons@1.2.2@compress-commons/lib/archivers/archive-output-stream.js:54:3) at module.exports.Transform._read (/Users/drex/Demo/demo-faas/node_modules/_readable-stream@2.3.7@readable-stream/lib/_stream_transform.js:184:10) at module.exports.Transform._write (/Users/drex/Demo/demo-faas/node_modules/_readable-stream@2.3.7@readable-stream/lib/_stream_transform.js:172:83) at doWrite (/Users/drex/Demo/demo-faas/node_modules/_readable-stream@2.3.7@readable-stream/lib/_stream_writable.js:428:64) at writeOrBuffer (/Users/drex/Demo/demo-faas/node_modules/_readable-stream@2.3.7@readable-stream/lib/_stream_writable.js:417:5) at module.exports.Writable.write (/Users/drex/Demo/demo-faas/node_modules/_readable-stream@2.3.7@readable-stream/lib/_stream_writable.js:334:11) at module.exports.ArchiveOutputStream.write (/Users/drex/Demo/demo-faas/node_modules/_compress-commons@1.2.2@compress-commons/lib/archivers/archive-output-stream.js:116:36) at module.exports.ZipArchiveOutputStream._writeLocalFileHeader (/Users/drex/Demo/demo-faas/node_modules/_compress-commons@1.2.2@compress-commons/lib/archivers/zip/zip-archive-output-stream.js:390:8) at module.exports.ZipArchiveOutputStream._appendStream (/Users/drex/Demo/demo-faas/node_modules/_compress-commons@1.2.2@compress-commons/lib/archivers/zip/zip-archive-output-stream.js:94:8) at module.exports.ArchiveOutputStream.entry (/Users/drex/Demo/demo-faas/node_modules/_compress-commons@1.2.2@compress-commons/lib/archivers/archive-output-stream.js:88:10) at module.exports.ZipStream.entry (/Users/drex/Demo/demo-faas/node_modules/_zip-stream@1.2.0@zip-stream/index.js:157:49) at Zip.append (/Users/drex/Demo/demo-faas/node_modules/_archiver@2.1.1@archiver/lib/plugins/zip.js:54:15) at Archiver._moduleAppend (/Users/drex/Demo/demo-faas/node_modules/_archiver@2.1.1@archiver/lib/core.js:179:16) at Archiver._onQueueTask (/Users/drex/Demo/demo-faas/node_modules/_archiver@2.1.1@archiver/lib/core.js:400:8) at /Users/drex/Demo/demo-faas/node_modules/_async@2.6.3@async/dist/async.js:4096:9 at Object.process (/Users/drex/Demo/demo-faas/node_modules/_async@2.6.3@async/dist/async.js:2344:17) at /Users/drex/Demo/demo-faas/node_modules/_async@2.6.3@async/dist/async.js:2252:19 at Immediate. (/Users/drex/Demo/demo-faas/node_modules/_async@2.6.3@async/dist/async.js:119:16) at processImmediate (internal/timers.js:439:21) at process.topLevelDomainCallback (domain.js:130:23)

 For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.

Get Support -------------------------------------------- Docs: docs.serverless.com Bugs: github.com/serverless/serverless/issues Issues: forum.serverless.com

Your Environment Information --------------------------- Operating System: darwin Node Version: 12.14.0 Framework Version: 1.62.0 Plugin Version: 3.3.0 SDK Version: 2.3.0 Components Core Version: 1.1.2 Components CLI Version: 1.4.0

idrex commented 4 years ago

换yarn,cnpm也报同样错误

czy88840616 commented 4 years ago

看起来是发布时压缩或者解压这一块。我们看一下。

czy88840616 commented 4 years ago

@idrex 原因已查明,由于 serverless framework 太大,我们做了一版非常大的优化把他去掉了(0.2.x -> 0.3.x),serverless plugin 我们为了兼容保持没动,但是内部 serverless framework 只会引用到最新的版本(0.3.x),所以产生了兼容性问题,我们现在把文档都更新了一下,使用了新版本的 cli 工具,大小和速度都有了明显的提升(30%以上),使用方式如下:

image

😁 另外,我们还在不断迭代过程中,和最终的 1.x 应该还有一些区别,如果有问题,可以随时咨询。

idrex commented 4 years ago

新版本存在一个问题,没有service name

czy88840616 commented 4 years ago

service name 是指? 新版本叫 f.yml,为了和 serverless framework 做区分,里面的内容和原 serverless.yml 基本一致。

idrex commented 4 years ago

这个可以理解,是提交到阿里云的时候,服务的名称会变成undefined,应该是传参赋值的问题

idrex commented 4 years ago

Waiting for service undefined to be deployed... Waiting for function index to be deployed... Waiting for packaging function index code... 这是终端显示的

czy88840616 commented 4 years ago

哦,是provide的name,新版本处理了这个问题