When npx sls deploy is run in circleci, error: "The authenticity of host 'bitbucket.org (xxxxx)' can't be established." occurs.
This is a (Bug Report)
Description
For bug reports:
- What went wrong?
Error occurs when npx sls deploy command is invoked in circleci and private bitbucket repo is referenced in package.json dependencies. Works fine when deploy from my local ubuntu 18.04 environment.
- What did you expect should have happened?
nodejs app should be deployed to AWS lambda
- What was the config you used?
plugins:
- serverless-webpack
and the following custom config in serverless.yml
custom: webpack: includeModules: true
and in package.json
"dependencies": { "privaterepo": "git+ssh://[email protected]/{team-name}/{repo-name}.git#1.0.0", .... }
- What stacktrace or error message from your provider did you see?
For NPM packager:
The authenticity of host 'bitbucket.org (xxxx)' can't be established. RSA key fingerprint is SHA256:...... Are you sure you want to continue connecting (yes/no)? The authenticity of host 'bitbucket.org (xxxx)' can't be established. RSA key fingerprint is SHA256:........ Are you sure you want to continue connecting (yes/no)? Too long with no output (exceeded 10m0s): context deadline exceeded
For Yarn packager:
Error --------------------------------------------------
Error: yarn install --frozen-lockfile --non-interactive failed with code 128
at ChildProcess.
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
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.0 Framework Version: 1.71.3 Plugin Version: 3.6.12 SDK Version: 2.3.1 Components Version: 2.30.11
Exited with code exit status 1
Additional Data
serverless-webpack version: "^5.3.1"
CircleCi docker config:
version: 2.1
executors: mainexec: docker: - image: circleci/node:12.16.0
The error only occurs when the npx sls deploy is run in circleci. Looks like a child_process is spawned with the yarn/npm command to install all external dependencies. Somewhere, a new Process() is instantiated to run the command which may have lost context reference to the ssh keys in circleci.
@JonahAcquah this seems to be an issue with SSH host verification.
Would you be able to try adding bitbucket.org to your known_hosts?
This should fetch the keys for you and add them:
mkdir -p ~/.ssh/ && \
ssh-keyscan bitbucket.org >>~/.ssh/known_hosts