sentry-cli icon indicating copy to clipboard operation
sentry-cli copied to clipboard

JS layer for sentry-cli should allow passing multiple headers

Open thibmeu opened this issue 3 years ago • 1 comments

At the moment, JS layer above sentry-cli allow passing at most one header, as follow

import Sentry from '@sentry/cli'

const cli = new Sentry(undefined, {
  // Note the singular for custom header. there is only one
  customHeader: 'Authorization: Bearer deadbeef',
})
console.log(await cli.info('my-release'))

The above configuration makes sentry-cli use the custom header by setting CUSTOM_HEADER environment variable when invoking sentry-cli.

sentry-cli supports passing multiple headers via --header key:value. There are situation for which setting multiple headers is good, and limiting sentry-cli JS layer makes it less useful. At the moment, I understand passing multiple headers has to be done as follow

import Sentry from '@sentry/cli'

const cli = new Sentry(undefined, {
  // Nothing here
})
console.log(await cli.execute('--header', 'key1:value1', '--header', 'key2:value2', 'info', 'my-release'))

I suggest JS layer to define the below interface

import Sentry from '@sentry/cli'

const cli = new Sentry(undefined, {
  // headers is a Record<string, string>
  headers: {
    'Authorization': 'Bearer deadbeef',
  },
})
console.log(await cli.info('my-release'))

thibmeu avatar Oct 12 '22 09:10 thibmeu

This relates to #1142 which is about adding support for multiple headers to the CLI tool.

Lekensteyn avatar Oct 12 '22 10:10 Lekensteyn

Thanks @kamilogorek for the review and the merge.

Are there information about the release process available? I'd be interested to know when this change would land in the upstream npm package.

thibmeu avatar Oct 21 '22 06:10 thibmeu

Will update it early next week, as there are a few things remaining to tackle before that. Will keep you posted.

kamilogorek avatar Oct 21 '22 09:10 kamilogorek

@thibmeu 2.8.0 is out.

kamilogorek avatar Oct 24 '22 11:10 kamilogorek

Thanks @kamilogorek. That's was super fast!

thibmeu avatar Oct 24 '22 15:10 thibmeu