Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fun deploy NODE_PATH 环境变量不正确 #879

Closed
vangie opened this issue Apr 21, 2020 · 0 comments · Fixed by #880
Closed

Fun deploy NODE_PATH 环境变量不正确 #879

vangie opened this issue Apr 21, 2020 · 0 comments · Fixed by #880
Assignees
Projects

Comments

@vangie
Copy link
Collaborator

vangie commented Apr 21, 2020

该问题会导致 nas 上的 uuid 库引用不到。

image

改成如下以后就正常了。
image

发现问题的 fun 版本 3.6.9。

出现问题的 template.yml 的内容如下

ROSTemplateFormatVersion: '2015-09-01'
Transform: 'Aliyun::Serverless-2018-04-03'
Resources:
  uuid-example:
    Type: 'Aliyun::Serverless::Service'
    Properties:
      Description: This is FC service
      Role: 'acs:ram::1986114430573743:role/fc-public-test'
      NasConfig: Auto
    uuid-example2:
      Type: 'Aliyun::Serverless::Function'
      Properties:
        Handler: index.handler
        Runtime: nodejs10
        Timeout: 120
        CodeUri: ./
        MemorySize: 1024
        EnvironmentVariables:
          NODE_PATH: '/mnt/auto/node_modules:/usr/local/lib/node_modules'

测试代码

'use strict';
const uuid = require('uuid');


module.exports.handler = function(event, context, callback) {
  console.log(uuid.v1());
  callback(null, uuid.v1());
}

.nas.yml

nasMappings:
  uuid-example:
    - localNasDir: node_modules
      remoteNasDir: /mnt/auto/node_modules
@vangie vangie added this to To do in 3.6.11 Apr 21, 2020
@tanhe123 tanhe123 moved this from To do to Done in 3.6.11 Apr 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
3.6.11
  
Done
Development

Successfully merging a pull request may close this issue.

2 participants