简体   繁体   中英

Unable to find good bind path format when deploying AWS Lambda via GitHub action and serverless framework

Trying to use serverless framework to deploy AWS Lambda with Github action running on Windows Server 2019 but deployment fails with

Unable to find good bind path format

This is how my action template looks like:

name: deploy-aws-lambda
on:
  push:
    branches:
      - master
jobs:
  deploy:
    runs-on: windows-latest
    strategy:
      matrix:
        node-version: [14.x]
    steps:
      - uses: actions/checkout@master
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node-version }}
      - name: Install Dependencies
        run: npm install
      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v1
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: eu-west-1
      - name: Serverless Deploy
        run: npm run-script deploy

The script deploy runs serverless deploy

My serverless.yml

service: test

provider:
  name: aws
  runtime: python3.8
  region: eu-west-1
  memorySize: 256
  timeout: 15

functions:
  main:
    handler: handler.main
    events:
      - http:
          path: /
          method: get
      
plugins:
  - serverless-python-requirements

custom:
  pythonRequirements:
    dockerizePip: non-linux

package:
  exclude:
    - node_modules/**
    - .vscode/**
    - .github/**

My package.json

{
  "name": "test",
  "version": "1.0.0",
  "description": "This is test",
  "dependencies": {},
  "devDependencies": {
    "serverless": "^2.33.1",
    "serverless-python-requirements": "^5.1.1"
  },
  "scripts": {
    "deploy": "serverless deploy"
  },
  "author": "",
  "license": "ISC"
}

Sample lambda function handler.py

import json


def main(event, context):
    body = {
        "message": "Go Serverless v1.0! Your function executed successfully!",
        "input": event
    }

    response = {
        "statusCode": 200,
        "body": json.dumps(body)
    }

    return response
}

Sample requirements.txt

requests
numpy

Log and trace on after calling deploy:

Serverless: Generated requirements from D:\a\telegram-bot\telegram-bot\requirements.txt in D:\a\telegram-bot\telegram-bot\.serverless\requirements.txt...
Serverless: Installing requirements from C:\Users\runneradmin\AppData\Local\UnitedIncome\serverless-python-requirements\Cache\5e61405b67ffec41db1bbd78f432bc4fd4ccdf0af1764200fd7a3859b7126a39_slspyc\requirements.txt ...
Serverless: Docker Image: lambci/lambda:build-python3.8
 
  Error --------------------------------------------------
 
  Error: Unable to find good bind path format
      at getBindPath (D:\a\telegram-bot\telegram-bot\node_modules\serverless-python-requirements\lib\docker.js:152:9)
      at installRequirements (D:\a\telegram-bot\telegram-bot\node_modules\serverless-python-requirements\lib\pip.js:198:39)
      at installRequirementsIfNeeded (D:\a\telegram-bot\telegram-bot\node_modules\serverless-python-requirements\lib\pip.js:556:3)
      at ServerlessPythonRequirements.installAllRequirements (D:\a\telegram-bot\telegram-bot\node_modules\serverless-python-requirements\lib\pip.js:635:29)
      at ServerlessPythonRequirements.tryCatcher (D:\a\telegram-bot\telegram-bot\node_modules\bluebird\js\release\util.js:16:23)
      at Promise._settlePromiseFromHandler (D:\a\telegram-bot\telegram-bot\node_modules\bluebird\js\release\promise.js:547:31)
      at Promise._settlePromise (D:\a\telegram-bot\telegram-bot\node_modules\bluebird\js\release\promise.js:604:18)
      at Promise._settlePromise0 (D:\a\telegram-bot\telegram-bot\node_modules\bluebird\js\release\promise.js:649:10)
      at Promise._settlePromises (D:\a\telegram-bot\telegram-bot\node_modules\bluebird\js\release\promise.js:729:18)
      at _drainQueueStep (D:\a\telegram-bot\telegram-bot\node_modules\bluebird\js\release\async.js:93:12)
      at _drainQueue (D:\a\telegram-bot\telegram-bot\node_modules\bluebird\js\release\async.js:86:9)
      at Async._drainQueues (D:\a\telegram-bot\telegram-bot\node_modules\bluebird\js\release\async.js:102:5)
      at Immediate.Async.drainQueues [as _onImmediate] (D:\a\telegram-bot\telegram-bot\node_modules\bluebird\js\release\async.js:15:14)
      at processImmediate (internal/timers.js:461:21)

Locally this deployment process works just fine on my Windows 10 machine, though I'm using Docker Desktop and the machine in question is Windows Server 2019. Any workarounds or fixes for this problem?

add "return servicePath;" line at the end of getBindPath function in D:\a\telegram-bot\telegram-bot\node_modules\serverless-python-requirements\lib\docker.js:152:9

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM