Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
305 views
in Technique[技术] by (71.8m points)

python - 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.22.0",
    "serverless-python-requirements": "^5.1.0"
  },
  "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:aelegram-botelegram-bot
equirements.txt in D:aelegram-botelegram-bot.serverless
equirements.txt...
Serverless: Installing requirements from C:Users
unneradminAppDataLocalUnitedIncomeserverless-python-requirementsCache5e61405b67ffec41db1bbd78f432bc4fd4ccdf0af1764200fd7a3859b7126a39_slspyc
equirements.txt ...
Serverless: Docker Image: lambci/lambda:build-python3.8
 
  Error --------------------------------------------------
 
  Error: Unable to find good bind path format
      at getBindPath (D:aelegram-botelegram-bot
ode_modulesserverless-python-requirementslibdocker.js:152:9)
      at installRequirements (D:aelegram-botelegram-bot
ode_modulesserverless-python-requirementslibpip.js:198:39)
      at installRequirementsIfNeeded (D:aelegram-botelegram-bot
ode_modulesserverless-python-requirementslibpip.js:556:3)
      at ServerlessPythonRequirements.installAllRequirements (D:aelegram-botelegram-bot
ode_modulesserverless-python-requirementslibpip.js:635:29)
      at ServerlessPythonRequirements.tryCatcher (D:aelegram-botelegram-bot
ode_modulesluebirdjs
eleaseutil.js:16:23)
      at Promise._settlePromiseFromHandler (D:aelegram-botelegram-bot
ode_modulesluebirdjs
eleasepromise.js:547:31)
      at Promise._settlePromise (D:aelegram-botelegram-bot
ode_modulesluebirdjs
eleasepromise.js:604:18)
      at Promise._settlePromise0 (D:aelegram-botelegram-bot
ode_modulesluebirdjs
eleasepromise.js:649:10)
      at Promise._settlePromises (D:aelegram-botelegram-bot
ode_modulesluebirdjs
eleasepromise.js:729:18)
      at _drainQueueStep (D:aelegram-botelegram-bot
ode_modulesluebirdjs
eleaseasync.js:93:12)
      at _drainQueue (D:aelegram-botelegram-bot
ode_modulesluebirdjs
eleaseasync.js:86:9)
      at Async._drainQueues (D:aelegram-botelegram-bot
ode_modulesluebirdjs
eleaseasync.js:102:5)
      at Immediate.Async.drainQueues [as _onImmediate] (D:aelegram-botelegram-bot
ode_modulesluebirdjs
eleaseasync.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?

question from:https://stackoverflow.com/questions/66055156/unable-to-find-good-bind-path-format-when-deploying-aws-lambda-via-github-action

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...