Удачного рабочего дня для всех. Оставайтесь в безопасности!
Кстати, мне просто нужна помощь с проектом, над которым я работаю. По какой-то причине я получаю ошибку Cannot read property 'startsWith' of undefined
Я добавил плагин serverkess-step-functions. Запуск sls deploy
отобразит ошибку. Я не знаю, что не так.
Вот упрощенная версия моего serverless.yml:
service: rh-cron-service
provider:
name: aws
runtime: python3.6
stage: ${opt:stage, 'dev'}
region: us-east-1
# timeout: 10
environment:
DBHOST: ${self:custom.stageConfig.dbHost}
DBUSER: ${self:custom.stageConfig.dbUser}
DBPASSWORD: ${self:custom.stageConfig.dbPassword}
DBDATABASE: ${self:custom.stageConfig.dbDatabase}
DBPORT: ${self:custom.stageConfig.dbPort}
ENV: ${self:provider.stage}
REGION: ${self:provider.region}
SERVICE: ${self:service}
iamRoleStatements:
- Effect: Allow
Action:
- lambda:InvokeFunction
- lambda:InvokeAsync
Resource: "*"
package:
include:
- shared/**
- configs/**
exclude:
- venv/**
plugins:
- serverless-python-requirements
- serverless-stage-manager
- serverless-step-functions
- serverless-pseudo-parameters
custom:
stageConfig: ${file(configs/stages-config.yml):${self:provider.stage}}
pythonRequirements:
dockerizePip: non-linux
stages: # serverless-stage-manager
- dev
- staging
- prod
functions:
fetch_property_listings:
handler: functions.fetch_property_listings.handler
stepFunctions:
validate: true
stateMachines:
RHPropertiesCronMachine:
name: RHPropertiesCronMachine-${self:service}-${self:provider.stage}
dependsOn: CustomIamRole
definition:
Comment: "A State Machine that regularly updates the Realty Hub DB"
TimeoutSeconds: 900
StartAt: FetchMLSPropertylisting
States:
FetchMLSPropertylisting:
Type: Task
Resource:
Fn::GetAtt: [fetch_property_listings, Arn]
Retry:
- ErrorEquals:
- States.ALL
IntervalSeconds: 5
MaxAttempts: 3
BackoffRate: 2
Next: IsNextLinkAvailable
IsNextLinkAvailable:
Type: Choice
Choices:
- Variable: "$.isNextLinkAvailable"
BooleanEquals: true
Next: DebugTotalItem
Default: Done
DebugTotalItem:
Type: Pass
Next: FetchMLSPropertylisting
Done:
Type: Task
End: true
И это трассировка стека:
.Serverless: Packaging service...
Serverless: Excluding development dependencies...
Serverless: Injecting required Python packages to package...
Type Error ---------------------------------------------
TypeError: Cannot read property 'startsWith' of undefined
at /mnt/c/dev/realty-hub/mls-cron/serverless/rh-cron-service/node_modules/serverless-step-functions/lib/deploy/stepFunctions/compileIamRole.js:340:59
at arrayMap (/mnt/c/dev/realty-hub/mls-cron/serverless/rh-cron-service/node_modules/lodash/lodash.js:639:23)
at map (/mnt/c/dev/realty-hub/mls-cron/serverless/rh-cron-service/node_modules/lodash/lodash.js:9554:14)
at Function.flatMap (/mnt/c/dev/realty-hub/mls-cron/serverless/rh-cron-service/node_modules/lodash/lodash.js:9257:26)
at ServerlessStepFunctions.getIamPermissions (/mnt/c/dev/realty-hub/mls-cron/serverless/rh-cron-service/node_modules/serverless-step-functions/lib/deploy/stepFunctions/compileIamRole.js:298:12)
at /mnt/c/dev/realty-hub/mls-cron/serverless/rh-cron-service/node_modules/serverless-step-functions/lib/deploy/stepFunctions/compileIamRole.js:385:56
at Array.forEach (<anonymous>)
at ServerlessStepFunctions.compileIamRole (/mnt/c/dev/realty-hub/mls-cron/serverless/rh-cron-service/node_modules/serverless-step-functions/lib/deploy/stepFunctions/compileIamRole.js:378:32)
From previous event:
at PluginManager.invoke (/home/cijhake/.nvm/versions/node/v12.16.1/lib/node_modules/serverless/lib/classes/PluginManager.js:490:22)
at PluginManager.spawn (/home/cijhake/.nvm/versions/node/v12.16.1/lib/node_modules/serverless/lib/classes/PluginManager.js:510:17)
at Deploy.<anonymous> (/home/cijhake/.nvm/versions/node/v12.16.1/lib/node_modules/serverless/lib/plugins/deploy/deploy.js:115:50)
From previous event:
at Object.before:deploy:deploy [as hook] (/home/cijhake/.nvm/versions/node/v12.16.1/lib/node_modules/serverless/lib/plugins/deploy/deploy.js:100:30)
at /home/cijhake/.nvm/versions/node/v12.16.1/lib/node_modules/serverless/lib/classes/PluginManager.js:490:55
From previous event:
at PluginManager.invoke (/home/cijhake/.nvm/versions/node/v12.16.1/lib/node_modules/serverless/lib/classes/PluginManager.js:490:22)
at /home/cijhake/.nvm/versions/node/v12.16.1/lib/node_modules/serverless/lib/classes/PluginManager.js:525:24
From previous event:
at PluginManager.run (/home/cijhake/.nvm/versions/node/v12.16.1/lib/node_modules/serverless/lib/classes/PluginManager.js:525:8)
at /home/cijhake/.nvm/versions/node/v12.16.1/lib/node_modules/serverless/lib/Serverless.js:133:33
at processImmediate (internal/timers.js:456:21)
at process.topLevelDomainCallback (domain.js:137:15)
From previous event:
at Serverless.run (/home/cijhake/.nvm/versions/node/v12.16.1/lib/node_modules/serverless/lib/Serverless.js:120:74)
at /home/cijhake/.nvm/versions/node/v12.16.1/lib/node_modules/serverless/bin/serverless.js:82:30
at /home/cijhake/.nvm/versions/node/v12.16.1/lib/node_modules/serverless/node_modules/graceful-fs/graceful-fs.js:136:16
at /home/cijhake/.nvm/versions/node/v12.16.1/lib/node_modules/serverless/node_modules/graceful-fs/graceful-fs.js:57:14
at FSReqCallback.oncomplete (fs.js:154:23)
From previous event:
at /home/cijhake/.nvm/versions/node/v12.16.1/lib/node_modules/serverless/bin/serverless.js:82:8
at processImmediate (internal/timers.js:456:21)
at process.topLevelDomainCallback (domain.js:137:15)
From previous event:
at Object.<anonymous> (/home/cijhake/.nvm/versions/node/v12.16.1/lib/node_modules/serverless/bin/serverless.js:71:4)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
at Function.Module._load (internal/modules/cjs/loader.js:901:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:74:12)
at internal/main/run_main_module.js:18:47
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: linux
Node Version: 12.16.1
Framework Version: 1.67.0
Plugin Version: 3.5.0
SDK Version: 2.3.0
Components Version: 2.22.3
Надеюсь, вы можете помочь мне. Спасибо.