Open tdmalone opened 2 years ago
EDIT: This comment is now out-of-date - see the next comment.
The second error appears to be fixable with:
cd ../../../addons/addon-base/packages/serverless-settings-helper
yarn install
yarn link
cd ../../../../main/cicd/cicd-pipeline
yarn link @amzn/base-serverless-settings-helper
pnpx serverless deploy --stage dev
This then results in:
Error:
Cannot resolve serverless.yml: Variables resolution errored with:
- Cannot resolve variable at "custom.settings": Cannot resolve "merged" out of ".settings.js": Received rejection: TypeError: Cannot read properties of undefined (reading 'options')
at /Users/tim/service-workbench-on-aws/addons/addon-base/packages/serverless-settings-helper/lib/index.js:137:40
which can be resolved by changing line 137 in the above file:
- const stage = serverless.variables.options.s || serverless.variables.options.stage || undefined;
+ const stage = serverless.options.s || serverless.options.stage || undefined;
This then results in:
Error:
Cannot resolve serverless.yml: Variables resolution errored with:
- Cannot resolve variable at "custom.settings": Cannot resolve "merged" out of ".settings.js": Received rejection: TypeError: Cannot read properties of undefined (reading 'parse')
at /Users/tim/service-workbench-on-aws/addons/addon-base/packages/serverless-settings-helper/lib/index.js:83:40
Ok - eventually got there with a suggestion from a colleague - just run pnpm i
in the root folder, and this appears to fill in dependencies for all other packages as well.
I presume that may have also resolved most (all?) of the above errors.
So I guess the bug is, at least, that the step to run pnpm i
in the root folder is missing from the docs :)
Another step missing - config files are gitignored, so they never get pushed to the codecommit repo. You need to comment out the relevant lines in the root .gitignore.
Serverless also appears to not be able to find credentials from the ECS task metadata endpoint in CodeBuild:
CredentialsError: Missing credentials in config, if using AWS_CONFIG_FILE, set AWS_SDK_LOAD_CONFIG=1
Prepending the following to the pre_build
stage in the buildspec seems to work around this:
- CREDS="$(curl "http://169.254.170.2${AWS_CONTAINER_CREDENTIALS_RELATIVE_URI}")"
- aws configure set aws_access_key_id "$(echo "${CREDS}" | jq -r .AccessKeyId)"
- aws configure set aws_secret_access_key "$(echo "${CREDS}" | jq -r .SecretAccessKey)"
- aws configure set aws_session_token "$(echo "${CREDS}" | jq -r .Token)"
Hey @tdmalone I am not sure if you got this working or not. I was just able to successfully deploy the CI/CD pipeline using these instructions: https://github.com/awslabs/service-workbench-on-aws/tree/mainline/main/cicd. I believe the file you were linking is for our old documentation set when we used docusaurus for delivery.
I believe many of the errors you ran into were because you were using Serverless Framework V3 (Environment: darwin, node 18.5.0, framework 3.21.0, plugin 6.2.2, SDK 4.3.2
) while before SWB v5.2.3, we only supported using Serverless Framework v1. Upgrading to SWB v5.2.3 might fix lots of the errors you mentioned here. Would you be able to try and let me know?
I am going to add a backlog item to review the documentation on our side, but any information you can give us will help us in this process.
Thanks for bringing this all to our attention, Marianna
Hi @maghirardelli,
Thanks for your reply. We did eventually get it working after making lots of tweaks and fixes, some of which are outlined in this issue.
I believe the file you were linking is for our old documentation set when we used docusaurus for delivery.
Can I suggest that if documentation is no longer correct, it is removed from the repository.
I believe many of the errors you ran into were because you were using Serverless Framework V3...
If I missed this in the docs, apologies, however if it wasn't in the docs, obviously I would suggest that the version constraint should be added. I would presume it's quite natural to install the latest available version unless explicitly advised not to.
Describe the bug The documentation for the CI/CD pipeline appears to be incorrect:
pnpx sls deploy
is referenced a few times - this actually runs the 'structured liste' package (https://www.npmjs.com/package/sls) and thus doesn't deploy anything; it should probably bepnpx serverless deploy
instead?pnpx serverless deploy
instead then comes across an error accessing the @amzn/base-serverless-settings-helper package, which appears to not exist (either at https://www.npmjs.com/package/@amzn/base-serverless-settings-helper or https://www.npmjs.com/package/@amzn-oss/base-serverless-settings-helper, or anywhere else on npm that I can find)To Reproduce Steps to reproduce the behavior:
Expected behavior The instructions to work.
Actual behavior