-
Notifications
You must be signed in to change notification settings - Fork 28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: Value is not an object: undefined #36
Comments
import was wrong in the example for me. import { AWSConfig, SignatureV4 } from 'https://jslib.k6.io/aws/0.7.1/aws.js' has gotten me a step further |
This problem also occurs with sqs, even if i change the import to import { AWSConfig, SQSClient } from 'https://jslib.k6.io/aws/0.7.1/sqs.js' is there something im doing wrong? import exec from 'k6/execution';
import { AWSConfig, SQSClient } from 'https://jslib.k6.io/aws/0.7.1/aws.js'
const awsConfig = new AWSConfig({
region: 'ex',
accessKeyId: 'ex',
secretAccessKey: 'ex',
sessionToken: 'ex',
})
const sqs = new SQSClient(awsConfig)
const testQueue = 'ex'
export default function () {
// If our test queue does not exist, abort the execution.
const queuesResponse = sqs.listQueues()
if (queuesResponse.queueUrls.filter((q) => q === testQueue).length == 0) {
exec.test.abort()
}
// Send message to test queue
const res = sqs.sendMessage({
queueUrl: testQueue,
messageBody: JSON.stringify({
value: '123',
}),
})
console.log(res)
} |
Hey @txm062 I'm gonna check if I can reproduce and get back to you as soon as I have news 👍🏻 |
Hey team, I tried to clone the repo and run the tests in the library locally. But I ended up getting the same error. I'm in the process of adding a new redshift client to this repo. Here are the logs when I ran the tests in verbose mode I've been able to run an older version of the library (before adding the new signature concept). So I've been working on that for time being.
|
Hey folks 👋🏻 Sorry for the rather long delay, it took us quite some time to have the bandwidth to get back to this issue. We have just published version My findings where that the Can you try it out using the |
I'm trying to use k6 to test our Appsync API and getting somewhat similar error. I combined 2 examples from k6 docs/blogposts: import http from 'k6/http'
import { AWSConfig, SignatureV4 } from 'https://jslib.k6.io/aws/0.7.2/aws.js'
const environment = {.......}
const query = `
.....
`
const headers = {
'Content-Type': 'application/json',
Accept: '*/*',
'Accept-Encoding': 'gzip, deflate, br',
Connection: 'keep-alive',
'X-Session': environment.X_SESSION,
}
export default function() {
const awsConfig = new AWSConfig({
region: environment.aws_region,
accessKeyId: environment.AccessKeyId,
secretAccessKey: environment.SecretKey,
sessionToken: environment.SessionToken,
})
const signer = new SignatureV4({
service: 'appsync',
region: awsConfig.region,
credentials: {
accessKeyId: awsConfig.accessKeyId,
secretAccessKey: awsConfig.secretAccessKey,
sessionToken: awsConfig.sessionToken,
},
})
const signedRequest = signer.sign(
{
method: 'POST',
protocol: 'https',
hostname: environment.PUBLISHER_API_ENDPOINT_2_0,
headers: headers,
applyChecksum: true,
},
)
http.post(signedRequest.url, JSON.stringify({ query }), {
headers: signedRequest.headers,
})
} this script results in the next error:
Sorry, I cannot provide query and environmnet details for obvious reasons. |
Hey @rtim75 It looks like the way we had defined how we handle the second optional argument of the The master branch has a fix for this included. The fix will land in Let me know if that works for you 🙇 |
Thanks, @oleiade. I'll try this out this week 🙇 |
@oleiade import {AWSConfig, SignatureV4} from 'https://raw.githubusercontent.com/grafana/k6-jslib-aws/main/build/aws.js' now I'm getting the following error
I'm also able to get the same error if I pass an empty object to the sign method with jslib 0.7.2: const signedRequest = signer.sign(
{
method: 'POST',
protocol: 'https',
hostname: environment.PUBLISHER_API_ENDPOINT_2_0,
headers: headers,
applyChecksum: true,
},
{}
) |
I think this might be caused by the fact that you omitted the |
yes, now it works. Thanks a lot |
Glad to hear it @rtim75 🙇🏻 |
I'm trying to post to SNS and thought that your signatureV4 example might work. However even whilst using the example provided i get the error TypeError: Value is not an object: undefined. from the below line.
I've literally just copied the example except dropping the first .js from the import. Does this work for SNS or what am i missing?
As i said im just using the defaults and havent changed it for POST etc yet
The text was updated successfully, but these errors were encountered: