I am trying to fetch two tables using batch Get().
Error { ResourceNotFoundException: Requested resource not found
at Request.extractError (D: \Posts\node_modules\aws-sdk\lib\protocol\json.js:51:27)
at Request.callListeners (D:\Posts\node_modules\aws-sdk\lib\sequential_executor.js:106:20)
at Request.emit (D:\Posts\node_modules\aws-sdk\lib\sequential_executor.js:78:10)
at Request.emit (D: \Posts\node_modules\aws-sdk\lib\request.js:683:14)
at Request.transition (D: \Posts\node_modules\aws-sdk\lib\request.js:22:10)
at AcceptorStateMachine.runTo (D: \Posts\node_modules\aws-sdk\lib\state_machine.js:14:12)
at D: \Posts\node_modules\aws-sdk\lib\state_machine.js:26:10
at Request.<anonymous> (D:\Posts\node_modules\aws-sdk\lib\request.js:38:9)
at Request.<anonymous> (D:\Posts\node_modules\aws-sdk\lib\request.js:685:12)
at Request.callListeners (D:\Posts\node_modules\aws-sdk\lib\sequential_executor.js:116:18)
message: 'Requested resource not found',
code: 'ResourceNotFoundException',
time: 2019-09-23T07:29:13.128Z,
requestId: 'VVSRDL4V2299JSMFKD88R8TT77VV4KQNSO5AEMVJF66Q9ASUAAJG',
statusCode: 400,
retryable: false,
retryDelay: 24.23023597884083 }
Related
InvalidArgument: null
at Request.extractError (P:\Upwork\MyProject\backend\node_modules\aws-sdk\lib\services\s3.js:700:35)
at Request.callListeners (P:\Upwork\MyProject\backend\node_modules\aws-sdk\lib\sequential_executor.js:106:20)
at Request.emit (P:\Upwork\MyProject\backend\node_modules\aws-sdk\lib\sequential_executor.js:78:10)
at Request.emit (P:\Upwork\MyProject\backend\node_modules\aws-sdk\lib\request.js:688:14)
at Request.transition (P:\Upwork\MyProject\backend\node_modules\aws-sdk\lib\request.js:22:10)
at AcceptorStateMachine.runTo (P:\Upwork\MyProject\backend\node_modules\aws-sdk\lib\state_machine.js:14:12)
at P:\Upwork\MyProject\backend\node_modules\aws-sdk\lib\state_machine.js:26:10
at Request.<anonymous> (P:\Upwork\MyProject\backend\node_modules\aws-sdk\lib\request.js:38:9)
at Request.<anonymous> (P:\Upwork\MyProject\backend\node_modules\aws-sdk\lib\request.js:690:12)
at Request.callListeners (P:\Upwork\MyProject\backend\node_modules\aws-sdk\lib\sequential_executor.js:116:18) {
code: 'InvalidArgument',
region: null,
time: 2020-12-31T15:39:45.724Z,
requestId: '',
extendedRequestId: undefined,
cfId: undefined,
statusCode: 400,
retryable: false,
retryDelay: 85.1667642693943
}
This error occurs when trying to upload to DigitalOcean Spaces or Amazon S3.
The error message is very vague just supplying InvalidArgument as a reason.
code: 'InvalidArgument' suggests that there is an issue with the supplied uploadParams.
const uploadParams = {
Bucket: process.env.DIGITAL_OCEAN_PUBLIC_SPACE_NAME,
Key: `profile-picture/${userUUID}.jpg`,
Body: body,
ACL: 'public',
};
In my case we can see above that I was trying to use ACL: 'public'.
This is not a valid ACL value, a value of ACL: 'public-read' should be used. For private objects you should use ACL: 'private'. The documentation can be found here.
If you receive this error check that your bucket name, ACL values and all of your uploadParams are valid.
I need to call an API Gateway method protected with IAM authentication from an Elastic Beanstalk application. But to create a signed request, I need access/secret key and session token. So I tried using the MetadataService
console.log('Using metadata service');
const metadata = new AWS.MetadataService();
const metadataRequest = util
.promisify(metadata.request)
.bind(metadata);
const data = await metadataRequest(
'/latest/meta-data/identity-credentials/ec2/security-credentials/ec2-instance'
);
sessionData = JSON.parse(data);
console.log(
'typeof sessionData',
typeof sessionData,
sessionData.Token
);
sessionData = {
...sessionData,
SessionToken: sessionData.Token
};
but when I called the API I get:
[9d3a82369277] gfx5000000 Error: Request failed with status code 403
at createError
(/var/app/current/node_modules/aws-api-gateway-client/node_modules/axios/lib/core/createError.js:16:15)
at settle
(/var/app/current/node_modules/aws-api-gateway-client/node_modules/axios/lib/core/settle.js:18:12)
at IncomingMessage.handleStreamEnd
(/var/app/current/node_modules/aws-api-gateway-client/node_modules/axios/lib/adapters/http.js:202:11)
at IncomingMessage.emit (events.js:203:15) at
IncomingMessage.EventEmitter.emit (domain.js:448:20) at endReadableNT
(_stream_readable.js:1129:12) at
/var/app/current/node_modules/async-listener/glue.js:188:31 at
process._tickCallback (internal/process/next_tick.js:63:19)
I also tried using getSessionToken but realised I cannot do that since I am using a role.
Then I tried assumeRole,
console.log('Assuming role');
sessionData = await sts
.assumeRole({
RoleArn:
'arn:aws:iam::906981349885:role/genflix-beanstalk-ec2-role',
RoleSessionName: 'genflix-eb'
})
.promise();
console.log(sessionData);
sessionData = sessionData.Credentials;
where I assume the same role as the current EC2, but got:
AccessDenied: Access denied
at Request.extractError (/var/app/current/node_modules/aws-sdk/lib/protocol/query.js:50:29)
at Request.callListeners (/var/app/current/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
at Request.emit (/var/app/current/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/var/app/current/node_modules/aws-sdk/lib/request.js:683:14)
at Request.transition (/var/app/current/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/var/app/current/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /var/app/current/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/var/app/current/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (/var/app/current/node_modules/aws-sdk/lib/request.js:685:12)
at Request.callListeners (/var/app/current/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
at Request.emit (/var/app/current/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
at Request.emit (/var/app/current/node_modules/aws-sdk/lib/request.js:683:14)
at Request.transition (/var/app/current/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/var/app/current/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /var/app/current/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/var/app/current/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (/var/app/current/node_modules/aws-sdk/lib/request.js:685:12)
at Request.callListeners (/var/app/current/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
at callNextListener (/var/app/current/node_modules/aws-sdk/lib/sequential_executor.js:96:12)
at IncomingMessage.onEnd (/var/app/current/node_modules/aws-sdk/lib/event_listeners.js:307:13)
at IncomingMessage.emit (events.js:203:15)
at IncomingMessage.EventEmitter.emit (domain.js:448:20)
at endReadableNT (_stream_readable.js:1129:12)
at /var/app/current/node_modules/async-listener/glue.js:188:31
at process._tickCallback (internal/process/next_tick.js:63:19)
What should I use?
Jiew, I would suggest to generate the SDK for API Gateway and use it in your code. https://docs.aws.amazon.com/apigateway/latest/developerguide/how-to-generate-sdk.html
I'm trying to update multiple items using TransactWriteItems, But I have got the following error:
{
UnknownOperationException: An unknown operation was requested.
at Request.extractError (project-dir\node_modules\aws-sdk\lib\protocol\json.js:51:27)
at Request.callListeners (project-dir\node_modules\aws-sdk\lib\sequential_executor.js:106:20)
at Request.emit (project-dir\node_modules\aws-sdk\lib\sequential_executor.js:78:10)
at Request.emit (project-dir\node_modules\aws-sdk\lib\request.js:683:14)
at Request.transition (project-dir\node_modules\aws-sdk\lib\request.js:22:10)
at AcceptorStateMachine.runTo (project-dir\node_modules\aws-sdk\lib\state_machine.js:14:12)
at project-dir\node_modules\aws-sdk\lib\state_machine.js:26:10
at Request.<anonymous> (project-dir\node_modules\aws-sdk\lib\request.js:38:9)
at Request.<anonymous> (project-dir\node_modules\aws-sdk\lib\request.js:685:12)
at Request.callListeners (project-dir\node_modules\aws-sdk\lib\sequential_executor.js:116:18)
message: 'An unknown operation was requested.',
code: 'UnknownOperationException',
time: 2019-06-21T18:28:46.776Z,
requestId: '',
statusCode: 400,
retryable: false,
retryDelay: 17.98291928629798
}
My Code is given below:
const dynamodb = new aws.DynamoDB({ endpoint: "http://localhost:8000" });
const result = await dynamodb
.transactWriteItems({
TransactItems: [{
"Update":{
"TableName":"dbTable1",
"Key":{
"id": { "S":"table-primary-key-id-01" }
},
"ConditionExpression": "#id = :id",
"UpdateExpression":"set #orderNo = :orderNo",
"ExpressionAttributeNames": {
"#id": "id",
"#orderNo":"orderNo"
},
"ExpressionAttributeValues":{
":id":{"S":"table-primary-key-id-01"},
":orderNo":{"N":"9"}
}
}
}]
})
.promise();
Any help would be very much appreciable. Thanks in advance.
I see you are running the TransactWriteItems operation on a local dynamodb instance. Unfortunately AWS has not implemented support for Transactions API call for dynamodb local instances.
I'm testing Amazon SageMaker service with NodeJS + AWS SDK and after create a new model and endpoint based on this example (everything works well in the notebook, including the request to the endpoint), I'm trying to create requests from my Express application, but I'm getting the following error:
Error during recognition: { InvalidImageFormatException: Request has Invalid image format
at Request.extractError (/Users/pdonaire/Documents/workspaceNode/trsps-controller/node_modules/aws-sdk/lib/protocol/json.js:48:27)
at Request.callListeners (/Users/pdonaire/Documents/workspaceNode/trsps-controller/node_modules/aws-sdk/lib/sequential_executor.js:109:20)
at Request.emit (/Users/pdonaire/Documents/workspaceNode/trsps-controller/node_modules/aws-sdk/lib/sequential_executor.js:81:10)
at Request.emit (/Users/pdonaire/Documents/workspaceNode/trsps-controller/node_modules/aws-sdk/lib/request.js:683:14)
at Request.transition (/Users/pdonaire/Documents/workspaceNode/trsps-controller/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/Users/pdonaire/Documents/workspaceNode/trsps-controller/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /Users/pdonaire/Documents/workspaceNode/trsps-controller/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/Users/pdonaire/Documents/workspaceNode/trsps-controller/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (/Users/pdonaire/Documents/workspaceNode/trsps-controller/node_modules/aws-sdk/lib/request.js:685:12)
at Request.callListeners (/Users/pdonaire/Documents/workspaceNode/trsps-controller/node_modules/aws-sdk/lib/sequential_executor.js:119:18)
at Request.emit (/Users/pdonaire/Documents/workspaceNode/trsps-controller/node_modules/aws-sdk/lib/sequential_executor.js:81:10)
at Request.emit (/Users/pdonaire/Documents/workspaceNode/trsps-controller/node_modules/aws-sdk/lib/request.js:683:14)
at Request.transition (/Users/pdonaire/Documents/workspaceNode/trsps-controller/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/Users/pdonaire/Documents/workspaceNode/trsps-controller/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /Users/pdonaire/Documents/workspaceNode/trsps-controller/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/Users/pdonaire/Documents/workspaceNode/trsps-controller/node_modules/aws-sdk/lib/request.js:38:9)
message: 'Request has Invalid image format',
code: 'InvalidImageFormatException',
time: 2018-09-10T04:42:07.530Z,
requestId: 'de3a04ff-b4b3-11e8-9bd8-8b88f803570c',
statusCode: 400,
retryable: false,
retryDelay: 55.860720412209794 }
My code is as follows:
export function sendRequestToSageMaker(base64image) {
const params = {
Body: new Buffer(base64image, 'base64') , /* Strings will be Base-64 encoded on your behalf */ /* required */
EndpointName: 'DEMO-imageclassification-ep--XXXX', /* required */
Accept: 'application/json',
ContentType: 'application/x-image'
};
sagemakerruntime.invokeEndpoint(params, function(err, data) {
if (err)
console.error(err, err.stack); // an error occurred
else
console.log(data); // successful response
});
return null;
}
base64image is req.body.photo from a request that I'm doing with Postman with a JSON and just a single photo property with a base64 string that I've made with base64-image.de website.
Any help will be helpful! Thank you so much! :-)
the SageMaker image classification algorithm only supports images as payload and does not support base64 encoded payload and that is why you see the InvalidImageFormatException.
I have a lambda function where I am trying to publish a message to SNS topic:
Here is the code:
var params = {
Message: origmessage,
Subject: "Retrying posting URL",
TopicArn: "arn:aws:sns:us-west-2:<acctid>:SampleTopic"
};
sns.publish(params, function(err, data) {
if (err) {
console.log("SNS publish error")
console.log(err, err.stack)
console.log(data, data)
console.log("RETRY PARAMS:" + params);
context.fail(err);
}
});
SNS publish error is cryptic as I am unable to find the root cause. Appreciate if someone can help me show a way to debug this.
Here is the error:
2017-01-19T00:41:13.947Z d440064d-dddf-11e6-abad-8de6d2739d36 {
[404: null]
message: null,
code: 404,
time: Thu Jan 19 2017 00:41:13 GMT+0000 (UTC),
requestId: '0ENTKJ09RT82VE0SFEUJKT75NVVV4KQNSO5AEMVJF66Q9ASUAAJG',
statusCode: 404,
retryable: false,
retryDelay: 26.97333029936999
}
'404: null
at Request.extractError (/var/task/node_modules/aws-sdk/lib/protocol/query.js:45:29)
at Request.callListeners (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:105:20)
at Request.emit (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:77:10)
at Request.emit (/var/task/node_modules/aws-sdk/lib/request.js:668:14)
at Request.transition (/var/task/node_modules/aws-sdk/lib/request.js:22:10)
at AcceptorStateMachine.runTo (/var/task/node_modules/aws-sdk/lib/state_machine.js:14:12)
at /var/task/node_modules/aws-sdk/lib/state_machine.js:26:10
at Request.<anonymous> (/var/task/node_modules/aws-sdk/lib/request.js:38:9)
at Request.<anonymous> (/var/task/node_modules/aws-sdk/lib/request.js:670:12)
at Request.callListeners (/var/task/node_modules/aws-sdk/lib/sequential_executor.js:115:18)'
As per your comments, when you use AWS.config.update, it affects all services.
By setting the endpoint parameter to the dynamodb endpoint, you are setting that endpoint for all services, including SNS.
This is an offending example where it says to specify the endpoint for dynamodb:
http://docs.aws.amazon.com/amazondynamodb/latest/gettingstartedguide/GettingStarted.NodeJs.Summary.html
Instead, the endpoint should be taken out of AWS.config.update and somehow specified in each service's constructor.
Matt - That was it. Dynamodb config was what was causing this issue. Appreciate all your help.
Thanks