aliyun / serverless-aliyun-function-compute

Serverless Alibaba Cloud Function Compute Plugin – Add Alibaba Cloud Function Compute support to the Serverless Framework
134 stars 16 forks source link

POST API gateway 创建失败 #10

Open buhe opened 7 years ago

buhe commented 7 years ago
 Missing Body Format Error ------------------------------

  The BodyFormat is mandatory for this action.

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

  Stack Trace --------------------------------------------

MissingBodyFormatError: The BodyFormat is mandatory for this action.
    at httpx.request.then.then (/Users/buhe/github/white-lambda-fork/node_modules/@alicloud/pop-core/lib/core.js:165:19)
    at <anonymous>
    at process._tickDomainCallback (internal/process/next_tick.js:228:7)
From previous event:
    at PluginManager.invoke (/Users/buhe/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/classes/PluginManager.js:366:22)
    at PluginManager.run (/Users/buhe/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/classes/PluginManager.js:397:17)
    at variables.populateService.then (/Users/buhe/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/Serverless.js:104:33)
    at runCallback (timers.js:789:20)
    at tryOnImmediate (timers.js:751:5)
    at processImmediate [as _immediateCallback] (timers.js:722:5)
From previous event:
    at Serverless.run (/Users/buhe/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/lib/Serverless.js:91:74)
    at serverless.init.then (/Users/buhe/.nvm/versions/node/v8.9.1/lib/node_modules/serverless/bin/serverless:42:50)
    at <anonymous>

然后只能界面去改一下,这个阻塞使用了,请帮忙看看。怀疑是少传了 body format 参数?没去仔细看

joyeecheung commented 7 years ago

请贴出你的 serverless.yml 里的 endpoint

buhe commented 7 years ago

ok 我懂了,没有配置全 bodyFormat 这个如果是 「参数透传」,我应该不是配置成 form 吧?「参数透传」的枚举名字是?

谢谢

buhe commented 7 years ago

另外 「get」 method 的 endpoint ,默认也是「参数映射」,这个也想配置成「参数透传」,把 params 也传给 lambda ,请问怎么操作?

谢谢

joyeecheung commented 7 years ago

@buhe 这个插件实现的时候阿里云的 API Gateway 并不支持参数透传,现在不清楚支不支持,如果已经支持欢迎提交 PR 。

buhe commented 7 years ago

@joyeecheung Sadly 你依赖的已经是最新版本了,如果不支持用起来是很麻烦的,开发效率就下来了,这边的编排会改变界面上的修改,然后还要人工改回去,虽然比直接使用 fcli 还是提升了很多效率 @JacksonTian 有计划发布新版本么?看上次版本是 4个月前,而且没有找到相关文档和 repo

所以这个 PR 还真的提不了,依赖的 alicloud/cloudapi 是「闭源」的

buhe commented 7 years ago

@joyeecheung 现在界面上面已经支持了 参数透传

joyeecheung commented 7 years ago

@JacksonTian 把 alicloud/cloudapi 开源出来?

JacksonTian commented 7 years ago

@alicloud/cloudapi@1.1.0 我已经发布了,代码在 https://github.com/aliyun/cloudapi-nodejs-sdk

JacksonTian commented 7 years ago

@buhe 欢迎钉钉沟通下需求。

buhe commented 7 years ago

@JacksonTian

我找到了,https://help.aliyun.com/document_detail/43985.html?spm=5176.doc43623.2.4.tAZVOV

这里面的 requestMode 目前这个 plugins应该不支持,代码有点绕,我看看怎么基于 1.1.0 的 API 加进去。

@joyeecheung yml 里面加个 mode: MAPPING or PASSTHROUGH 的配置这样设计能接受么?可以我去看看怎么加

buhe commented 7 years ago
postTest:
    handler: index.postHandler
    events:
      - http:
          path: /baz
          method: post
          requestMode: passthrough

like this

joyeecheung commented 7 years ago

@buhe 可以的,谢谢