使用无服务器框架部署NodeJS函数时出现问题

编程入门 行业动态 更新时间:2024-10-17 19:29:09

使用无服务器框架部署NodeJS<a href=https://www.elefans.com/category/jswz/34/1771370.html style=函数时出现问题"/>

使用无服务器框架部署NodeJS函数时出现问题

我有一个具有此体系结构的应用程序:

-Function1
  .index.js
-Function2
  .index.py
  .requirements.txt
-Function3
  .index.py
  .requirements.txt
-Function4
  .index.py
  .requirements.txt
-node_modules
.serverless.yml
.package.json

我的问题是,当我调用无服务器部署时,我最终在NodeJS函数(Function1)中遇到了整个应用程序

仅使用NodeJS函数会发生此问题,Python函数仅具有与每个函数相关的代码。

注意 :我的serverless.yml中有这个:

package:
  individually: true
plugins:
  - serverless-python-requirements
  - serverless-iam-roles-per-function
  - serverless-pseudo-parameters
  - serverless-plugin-include-dependencies

谢谢你的帮助。

回答如下:

我正在使用/ typescript / es7来实现无服务器功能,请在serverless.yml中尝试以下操作:

plugins:
- ...
  - ...

provider:


name: aws
  runtime: **nodejs8.10**
  stage: ...
  profile: ...
  region: ...

functions:
  [function name]:
    handler: function1/index.js
    events:
      - http:
          method: get
          ...

更多推荐

使用无服务器框架部署NodeJS函数时出现问题

本文发布于:2024-05-05 17:35:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1752807.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:函数   框架   服务器   NodeJS

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!