Closed saiprasadrao closed 3 months ago
domainOwner should be a string
Hi @RanVaknin - Anything am i missing... please let me know.. with domainOwner as string still getting the same issue...
Hi @saiprasadrao ,
Thanks for reaching out. Unfortunately I'm not able to reproduce this behavior. Are you using an IDE to run your code? The code sample is not formatted correctly / incomplete.
const response = await client.publishPackageVersion(params)
, but this doesnt return a promise.assetSHA256
should be a SHA-256 hash of the asset content. It needs to be a 64character hexadecimal string. You can generate a valid SHA-256 hash for your file using a library like crypto
. Something like e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855
.import { CodeartifactClient, PublishPackageVersionCommand } from '@aws-sdk/client-codeartifact';
async function run() {
const params = {
assetContent: 'temp.tar.gz',
assetName: 'temp.tar.gz',
assetSHA256: 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855', // replace this with the sha256 has from generated from your assetContent
domain: 'test-domain',
format: 'generic',
package: 'test',
packageVersion: '0.0.1',
repository: 'test',
domainOwner: '121212121122',
namespace: 'test'
}
const client = new CodeartifactClient({ region: 'ap-south-1' })
try {
const response = await client.send(new PublishPackageVersionCommand(params));
console.log(response)
} catch (error) {
console.log(error)
}
}
run()
Let me know if this helps.
Thanks again, Ran~
Hi @RanVaknin,
i will test this out and let you know.. i believe its an issue with @smithy/signature-v4. Will confirm on this with code and probably the issue :)
Thanks and Regards, Sai Rao
I'm having the exact same issue, but with
const s3 = new S3ControlClient({ region: 'us-east-1' })
const response = s3.send(new GetPublicAccessBlockCommand({ AccountId: '112233445566' }))
version 3.507.0
with
new S3ControlClient({ region: 'us-east-1', logger: console })
endpoints Initial EndpointParams: {
"UseArnRegion": false,
"UseFIPS": false,
"Region": "us-east-1",
"UseDualStack": false,
"RequiresAccountId": true,
"AccountId": 112233445566
}
endpoints evaluateCondition: isSet($Region) = true
endpoints evaluateCondition: stringEquals($Region, snow) = false
endpoints evaluateCondition: isSet($OutpostId) = false
endpoints evaluateCondition: isSet($AccessPointName) = false
endpoints evaluateCondition: isSet($Bucket) = false
endpoints evaluateCondition: aws.partition($Region) = {
"dnsSuffix": "amazonaws.com",
"dualStackDnsSuffix": "api.aws",
"implicitGlobalRegion": "us-east-1",
"name": "aws",
"supportsDualStack": true,
"supportsFIPS": true,
"description": "US East (N. Virginia)"
}
endpoints assign: partitionResult := {
"dnsSuffix": "amazonaws.com",
"dualStackDnsSuffix": "api.aws",
"implicitGlobalRegion": "us-east-1",
"name": "aws",
"supportsDualStack": true,
"supportsFIPS": true,
"description": "US East (N. Virginia)"
}
endpoints evaluateCondition: isValidHostLabel($Region, true) = true
endpoints evaluateCondition: booleanEquals($UseFIPS, true) = false
endpoints evaluateCondition: isSet($RequiresAccountId) = true
endpoints evaluateCondition: booleanEquals($RequiresAccountId, true) = true
endpoints evaluateCondition: not(isSet($AccountId)) = false
endpoints evaluateCondition: isSet($AccountId) = true
endpoints evaluateCondition: not(isValidHostLabel($AccountId, false)) = false
endpoints evaluateCondition: isSet($Endpoint) = false
endpoints evaluateCondition: booleanEquals($UseFIPS, true) = false
endpoints evaluateCondition: booleanEquals($UseFIPS, true) = false
endpoints evaluateCondition: booleanEquals($UseFIPS, true) = false
endpoints evaluateCondition: booleanEquals($UseFIPS, true) = false
endpoints evaluateCondition: booleanEquals($UseFIPS, false) = true
endpoints evaluateCondition: booleanEquals($UseDualStack, true) = false
endpoints evaluateCondition: booleanEquals($UseFIPS, false) = true
endpoints evaluateCondition: booleanEquals($UseDualStack, true) = false
endpoints evaluateCondition: booleanEquals($UseFIPS, false) = true
endpoints evaluateCondition: booleanEquals($UseDualStack, false) = true
endpoints evaluateCondition: isSet($RequiresAccountId) = true
endpoints evaluateCondition: booleanEquals($RequiresAccountId, true) = true
endpoints evaluateCondition: isSet($AccountId) = true
endpoints Resolving endpoint from template: {
"url": "https://{AccountId}.s3-control.{Region}.{partitionResult#dnsSuffix}",
"properties": {
"authSchemes": [
{
"disableDoubleEncoding": true,
"name": "sigv4",
"signingName": "s3",
"signingRegion": "{Region}"
}
]
},
"headers": {}
}
endpoints Resolved endpoint: {
"headers": {},
"properties": {
"authSchemes": [
{
"disableDoubleEncoding": true,
"name": "sigv4",
"signingName": "s3",
"signingRegion": "us-east-1"
}
]
},
"url": "https://112233445566.s3-control.us-east-1.amazonaws.com/"
}
{
clientName: 'S3ControlClient',
commandName: 'GetPublicAccessBlockCommand',
input: { AccountId: 112233445566 },
error: TypeError: headers[headerName].trim is not a function
at getCanonicalHeaders (/path/get-s3-public-access-block-status/node_modules/@smithy/signature-v4/dist-cjs/index.js:129:58)
at _SignatureV4.signRequest (/path/get-s3-public-access-block-status/node_modules/@smithy/signature-v4/dist-cjs/index.js:378:30)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async _AwsSdkSigV4Signer.sign (/path/get-s3-public-access-block-status/node_modules/@aws-sdk/core/dist-cjs/index.js:112:27)
at async /path/get-s3-public-access-block-status/node_modules/@smithy/core/dist-cjs/index.js:167:14
at async /path/get-s3-public-access-block-status/node_modules/@smithy/middleware-retry/dist-cjs/index.js:320:38
at async /path/get-s3-public-access-block-status/node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js:33:22
at async file:///path/get-s3-public-access-block-status/node_modules/p-queue/dist/index.js:187:36 {
'$metadata': { attempts: 1, totalRetryDelay: 0 }
},
metadata: { attempts: 1, totalRetryDelay: 0 }
}
I figured out what was causing the issue in my case. I was taking account id as input from outside and it should be a string but turned out to be a number. Example code to reproduce the error:
import {
GetPublicAccessBlockCommand,
S3ControlClient,
} from '@aws-sdk/client-s3-control'
const s3 = new S3ControlClient({ region: 'us-east-1' })
s3.send(new GetPublicAccessBlockCommand({ AccountId: 112233445566 as unknown as string }))
.then(({ PublicAccessBlockConfiguration }) => PublicAccessBlockConfiguration)
.then(JSON.stringify)
.then(console.log)
.catch(console.error)
Would've been nice if the error was "AccountId should be a string" instead of "headers[headerName].trim is not a function"...
Seems like this is solved. If you are a new customer running into this issue, please create a new bug report.
Closing.
Thanks, Ran~
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs and link to relevant comments in this thread.
Checkboxes for prior research
Describe the bug
I am trying to use module "@aws-sdk/client-codeartifact@3.496.0" but below error when trying to use the command
Code
Error
SDK version number
@aws-sdk/client-codeartifact@3.496.0
Which JavaScript Runtime is this issue in?
Node.js
Details of the browser/Node.js/ReactNative version
node version : v20.10.0
Reproduction Steps
Observed Behavior
Throwing below error
Expected Behavior
It should able to publish artifact version to aws codeartifact
Possible Solution
No response
Additional Information/Context
No response