Closed BKSnake closed 2 years ago
I don't think the file system is accessible on Lambda so the profile provider isn't going to successfully build. It's not a fatal error and nothing bad will happen in that situation. We could change the log level from error to warning I suppose.
But problem in that, i didn't get response. I have another part code which i dont share and when i send command i didnt get response
All what i see in log it's
[ERROR] [2021-11-26T15:55:11Z] [0000007fa5854010] [AuthCredentialsProvider] - static: Profile credentials parser failed resolve credentials file path
@bretambrose
Your logs are empty except for that single line?
Your logs are empty except for that single line?
No, but one line is Error. Also It's strange as for me
Okay, let's i will send last my messages
Lambda use next iot host host_name: '"Secret".iot.us-west-2.amazonaws.com',
2021-11-29T12:37:36.441Z 75fcb460-cb7b-449f-841a-6733a18554ca INFO Create new iot connection object
--
| 2021-11-29T16:15:13.259+02:00 | [ERROR] [2021-11-29T14:15:13Z] [0000007fb73e6010] [AuthCredentialsProvider] - static: Profile credentials parser failed resolve credentials file path
-- | -- | --
| 2021-11-29T16:15:13.279+02:00 | [ERROR] [2021-11-29T14:15:13Z] [0000007f9dc661b0] [channel-bootstrap] - id=0x5582e44760: failed to create socket with error 1045
| 2021-11-29T16:15:13.279+02:00 | [WARN] [2021-11-29T14:15:13Z] [0000007f9dc661b0] [socket] - id=0x7f90000b90 fd=28: setsockopt() for NO_SIGNAL failed with errno 92. If you are having SIGPIPE signals thrown, you may want to install a signal trap in your application layer.
| 2021-11-29T16:15:13.377+02:00 | 2021-11-29T14:15:13.377Z 0dffcfe9-7ef9-416f-bda9-fb7861201e73 INFO [INFO] MQTT connected
Okay, I have 2 version
aws-iot-device-sdk
const express = require('express');
const router = express.Router();
const uuidv4 = require('uuid/v4');
const awsIot = require('aws-iot-device-sdk');
router.get('/', async (req, res) => {
try {
const connectOpts = {
clientId: uuidv4(),
protocol: 'wss',
host: '<secret>.iot.us-west-2.amazonaws.com',
keepalive: 1000,
};
client = awsIot.device(connectOpts);
client.on('error', (err) => {
console.error(err);
});
client.on('connect', () => {
console.log('MQTT connected');
});
client.on('message', function (topic, payload) {
console.log('message', topic, payload.toString());
});
} catch (e) {
console.log('Error catch =>', e);
}
res.send('AWs IoT v1');
});
module.exports = router;
and I'm getting
MQTT connected
but for aws-iot-device-sdk-v2
const router = express.Router();
const uuidv4 = require('uuid/v4');
const { mqtt, io, iot, auth } = require('aws-iot-device-sdk-v2');
io.enable_logging(io.LogLevel.ERROR);
router.get('/', async (req, res) => {
try {
const clientBootstrap = new io.ClientBootstrap();
const config = iot.AwsIotMqttConnectionConfigBuilder.new_with_websockets({
region: 'us-west-2',
credentials_provider: auth.AwsCredentialsProvider.newDefault()
})
.with_endpoint('<secret>.iot.us-west-2.amazonaws.com')
.with_keep_alive_seconds(1000)
.with_client_id(uuidv4())
.build();
console.log(config);
const client = new mqtt.MqttClient(clientBootstrap);
const clientConnection = client.new_connection(config);
clientConnection.on('error', (err) => {
console.error(err);
});
clientConnection.on('connect', () => {
console.log('MQTT connected');
});
clientConnection.on('disconnect', () => {
console.log('MQTT disconnect');
});
clientConnection.on('message', function (topic, payload) {
console.log('message', topic, payload.toString());
});
await clientConnection.connect()
} catch (e) {
console.log('Error catch =>', e);
}
res.send('AWs IoT v2');
});
module.exports = router;
I'm getting
[ERROR] [2021-11-29T13:16:09Z] [00007f09a4e0a780] [file-utils] - static: Failed to open file /home/venstar/.aws/config with errno 2
[ERROR] [2021-11-29T13:16:09Z] [00007f09a4e0a780] [file-utils] - static: Failed to open file /home/venstar/.aws/credentials with errno 2
[ERROR] [2021-11-29T13:16:09Z] [00007f09a4e0a780] [AuthCredentialsProvider] - static: Profile credentials parser could not load or parse a credentials or config file.
[ERROR] [2021-11-29T13:16:09Z] [00007f099dffb700] [socket] - id=0x7f098c000cd0 fd=29: connect failed with error code 101.
[ERROR] [2021-11-29T13:16:09Z] [00007f099dffb700] [channel-bootstrap] - id=0x6400490: failed to create socket with error 1049
[ERROR] [2021-11-29T13:16:37Z] [00007f099dffb700] [http-connection] - static: Client connection failed with error 1029 (AWS_IO_TLS_ERROR_NEGOTIATION_FAILURE).
[ERROR] [2021-11-29T13:16:37Z] [00007f099dffb700] [websocket-setup] - id=0x63c3fb0: Websocket setup failed to establish HTTP connection, error 1029 (AWS_IO_TLS_ERROR_NEGOTIATION_FAILURE).
CrtError: Failed to connect: aws-c-io: AWS_IO_TLS_ERROR_NEGOTIATION_FAILURE, TLS (SSL) negotiation failed
at /home/venstar/Developer/aws-iot-test/node_modules/aws-crt/dist/native/mqtt.js:286:36
at processTicksAndRejections (internal/process/task_queues.js:77:11) {
error: 'Failed to connect: aws-c-io: AWS_IO_TLS_ERROR_NEGOTIATION_FAILURE, TLS (SSL) negotiation failed',
error_code: undefined,
error_name: undefined
}
Error catch => Failed to connect: aws-c-io: AWS_IO_TLS_ERROR_NEGOTIATION_FAILURE, TLS (SSL) negotiation failed
What is wrong?
@bretambrose
Thanks
Can you post the entire log?
Greetings! It looks like this issue hasn’t been active in longer than a week. We encourage you to check if this is still an issue in the latest release. Because it has been longer than a week since the last update on this, and in the absence of more information, we will be closing this issue soon. If you find that this is still a problem, please feel free to provide a comment or add an upvote to prevent automatic closure, or if the issue is already closed, please feel free to open a new one.
Confirm by changing [ ] to [x] below:
Known Issue
<prefix>-ats.iot.<region>.amazonaws.com
Platform/OS/Hardware/Device AWS Lambda NodeJs 14 - arm
Describe the question
I'm getting this error on lambda
Also on Lambda I have host :.iot..amazonaws.com - without
ats
Thanks