mkloubert / vs-deploy

Visual Studio Code extension that provides commands to deploy files of a workspace to a destination.
https://marketplace.visualstudio.com/items?itemName=mkloubert.vs-deploy
MIT License
131 stars 24 forks source link

[target_s3bucket] FAILED: CredentialsError: Missing credentials in config #137

Closed matheusrufca closed 6 years ago

matheusrufca commented 6 years ago

I'm getting error when trying to deploy on S3 bucket.

Setting my credential type to"file", what should I put on config prop?

Deploy output:

Deploying '/dist/index.html' to 'index.html'... [FAILED: CredentialsError: Missing credentials in config]

settings.json:

{
  "settings": {},
  "folders": [{ "path": "D:\\Workspace\\sample" }],
  "deploy": {
    "packages": [
      {
        "name": "sample",
        "description": "sample",
        "files": [ "dist/**" ]
      }
    ],
    "targets": [
      {
        "type": "s3bucket",
        "name": "Sample",
        "bucket": "my-bucket.com.br",
        "credentials": {
          "type": "file",
          "config": {
            "credentials": {
              "filename": "./aws-credential.json"
            }
          }
        },
        "mappings": [{ "source": "/dist", "target": "/" }]
      }
    ]
  }
}
mkloubert commented 6 years ago

@matheusrufca

The value of the config property is directly send to the constructor of the credential class (in that case FileSystemCredentials, s. official documentation) of the aws-sdk, so it must contain the (full) path of the file.

{
    "targets": [
      {
        // ..

        "credentials": {
          "type": "file",
          "config": "/full/path/to/aws-credential.json"
        },

        // ..
      }
    ]
  }
}

Relative paths will not work as expected. I think they would be fully mapped to the working directory of the VSCode process or to the extension's directory, instead to workspace directory.

matheusrufca commented 6 years ago

Thanks @mkloubert! . It works. I've tried put relative path directly on config property but vs-code warns the following message when string is passed:

image

mkloubert commented 6 years ago

@matheusrufca

Now I understand why you thought, that you have to put an object as setting value there. This makes it a little bit unclear, of course :-)

But it is only a minor mistake in the package.json, Only something for the setting editor.

I will fix this. Thanks!

matheusrufca commented 6 years ago

@mkloubert in fact, putting a string on config was my first try, but i set workspace relative path and didn't work, then I tried a lot of variations, but as output message says that credentials is missing, mostly of my tries was putting an credentials object inside of config. But it's working now. Great vscode extension, works perfectly for my needs.