Amazon Athena MySQL connector: "Access denied for user '[USERNAME]'#'[IP]' (using password: YES)" - mysql

I have a MySQL database instance in AWS RDS. I'd like to access it using AWS Athena. I used the "Amazon Athena Lambda MySQL Connector" to set up the new Data Source:
https://github.com/awslabs/aws-athena-query-federation/tree/master/athena-mysql
I installed this using the Serverless Application Repository. Here's the application:
https://serverlessrepo.aws.amazon.com/applications/us-east-1/292517598671/AthenaMySQLConnector
In the application settings before deploying, I used the same SecurityGroupIDs and SubnetIds as I used in another lambda function that is able to query the same database just fine.
In the environment variables for the lambda, I have the connection string set under both the key default and rds_mysql_connection_string (rds_mysql is the name of the Data Source in Athena). The connection string is in the format:
mysql://jdbc:mysql://HOSTNAME.us-east-1.rds.amazonaws.com:3306/DBNAME?user=USERNAME&password=PASSWORD
When I try to switch to the new data source in the Athena query editor, I get this error:
Access denied for user '[USERNAME]'#'[IP]' (using password: YES)
I diff'ed the role for the lambda that can connect against the one for the connector and they're pretty much the same. I even tried giving the connector the exact same role for a minute but it didn't help.
Using the test button on the lambda function for the connector also throws an error, but this could be a red herring. I use a blank test event and I get this in the logs:
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.
Transforming org/apache/logging/log4j/core/lookup/JndiLookup (lambdainternal.CustomerClassLoader#1a6c5a9e)
START RequestId: 98cdd329-b0e5-49c4-8c9e-ae7b6f51dc2a Version: $LATEST
2022-10-20 03:38:51 98cdd329-b0e5-49c4-8c9e-ae7b6f51dc2a INFO BaseAllocator:58 - Debug mode disabled.
2022-10-20 03:38:51 98cdd329-b0e5-49c4-8c9e-ae7b6f51dc2a INFO DefaultAllocationManagerOption:97 - allocation manager type not specified, using netty as the default type
2022-10-20 03:38:51 98cdd329-b0e5-49c4-8c9e-ae7b6f51dc2a INFO CheckAllocator:73 - Using DefaultAllocationManager at memory/DefaultAllocationManagerFactory.class
2022-10-20 03:38:51 98cdd329-b0e5-49c4-8c9e-ae7b6f51dc2a WARN CompositeHandler:107 - handleRequest: Completed with an exception.
java.lang.IllegalStateException: Expected field name token but got END_OBJECT
at com.amazonaws.athena.connector.lambda.serde.BaseDeserializer.assertFieldName(BaseDeserializer.java:221) ~[task/:?]
at com.amazonaws.athena.connector.lambda.serde.BaseDeserializer.getType(BaseDeserializer.java:295) ~[task/:?]
at com.amazonaws.athena.connector.lambda.serde.DelegatingDeserializer.doDeserialize(DelegatingDeserializer.java:56) ~[task/:?]
at com.amazonaws.athena.connector.lambda.serde.DelegatingDeserializer.deserializeWithType(DelegatingDeserializer.java:49) ~[task/:?]
at com.fasterxml.jackson.databind.deser.impl.TypeWrappedDeserializer.deserialize(TypeWrappedDeserializer.java:74) ~[task/:?]
at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:322) ~[task/:?]
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4674) ~[task/:?]
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3666) ~[task/:?]
at com.amazonaws.athena.connector.lambda.handlers.CompositeHandler.handleRequest(CompositeHandler.java:99) [task/:?]
at lambdainternal.EventHandlerLoader$2.call(EventHandlerLoader.java:899) [aws-lambda-java-runtime-0.2.0.jar:?]
at lambdainternal.AWSLambda.startRuntime(AWSLambda.java:268) [aws-lambda-java-runtime-0.2.0.jar:?]
at lambdainternal.AWSLambda.startRuntime(AWSLambda.java:206) [aws-lambda-java-runtime-0.2.0.jar:?]
at lambdainternal.AWSLambda.main(AWSLambda.java:200) [aws-lambda-java-runtime-0.2.0.jar:?]
Expected field name token but got END_OBJECT: java.lang.IllegalStateException
java.lang.IllegalStateException: Expected field name token but got END_OBJECT
at com.amazonaws.athena.connector.lambda.serde.BaseDeserializer.assertFieldName(BaseDeserializer.java:221)
at com.amazonaws.athena.connector.lambda.serde.BaseDeserializer.getType(BaseDeserializer.java:295)
at com.amazonaws.athena.connector.lambda.serde.DelegatingDeserializer.doDeserialize(DelegatingDeserializer.java:56)
at com.amazonaws.athena.connector.lambda.serde.DelegatingDeserializer.deserializeWithType(DelegatingDeserializer.java:49)
at com.fasterxml.jackson.databind.deser.impl.TypeWrappedDeserializer.deserialize(TypeWrappedDeserializer.java:74)
at com.fasterxml.jackson.databind.deser.DefaultDeserializationContext.readRootValue(DefaultDeserializationContext.java:322)
at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:4674)
at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3666)
at com.amazonaws.athena.connector.lambda.handlers.CompositeHandler.handleRequest(CompositeHandler.java:99)
END RequestId: 98cdd329-b0e5-49c4-8c9e-ae7b6f51dc2a
REPORT RequestId: 98cdd329-b0e5-49c4-8c9e-ae7b6f51dc2a Duration: 343.41 ms Billed Duration: 344 ms Memory Size: 3008 MB Max Memory Used: 170 MB Init Duration: 2665.96 ms

Related

ESPHOME not working for MHz19 with Lolin D1 mini

I connected the MHz19 sensor to the D1 mini and want to flash it via ESP-Home.
I followed the following guide:
https://esphome.io/components/sensor/mhz19.html
I used the code
esphome:
name: co2-sensor
esp8266:
board: esp01_1m
# Enable logging
#logger:
# Enable Home Assistant API
api:
ota:
password: "xxxxxx"
wifi:
ssid: !secret wifi_ssid
password: !secret wifi_password
# Enable fallback hotspot (captive portal) in case wifi connection fails
ap:
ssid: "Co2-Sensor Fallback Hotspot"
password: "xxxxx"
captive_portal:
uart:
rx_pin: GPIO3
tx_pin: GPIO1
baud_rate: 9600
sensor:
- platform: mhz19
co2:
name: "CO2 Value"
temperature:
name: "MH-Z19 Temperature"
update_interval: 60s
automatic_baseline_calibration: false
But cannot flash, I get the following error
======================== [SUCCESS] Took 305.85 seconds ========================
INFO Successfully compiled program.
esptool.py v3.2
Serial port /dev/ttyUSB0
Connecting......................................
A fatal error occurred: Failed to connect to ESP8266: No serial data received.
For troubleshooting steps visit: https://github.com/espressif/esptool#troubleshooting
INFO Upload with baud rate 460800 failed. Trying again with baud rate 115200.
esptool.py v3.2
Serial port /dev/ttyUSB0
Connecting......................................
A fatal error occurred: Failed to connect to ESP8266: No serial data received.
For troubleshooting steps visit: https://github.com/espressif/esptool#troubleshooting
I can however flash it and it comes online if I disconnect the sensor, of course it publishes no data. So I assume it's something to do with UART. I also tried disabling the logging, which did nothing.
It seems the UART pins used by default for debug logging, even though I thought I had disabled the logging option. I used pin 4 and 5 and it worked.
https://esphome.io/components/uart.html#uart
Note that the value I got was 5000 ppm at first, when it was plugged into the Pi on which I'm running HA. When connecting to another PSU I got 'normal' looking values. I assume it simply did not get enough power from the PI.

Getting “Failed to connect to the bus: Could not parse server address” error when launch Chrome in CentOS using puppeter

I am trying to launch Chrome in CentOS using puppeteer but got errors like this:
[8012:8039:1220/204633.586208:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[8012:8039:1220/204633.586325:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[8012:8039:1220/204633.595443:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[8012:8039:1220/204633.595473:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
DevTools listening on ws://127.0.0.1:48513/devtools/browser/ede9735a-7c4d-49db-a5c7-a1da0240b889
[8012:8039:1220/204633.619981:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[8012:8039:1220/204633.620005:ERROR:bus.cc(393)] Failed to connect to the bus: Could not parse server address: Unknown address type (examples of valid types are "tcp" and on UNIX "unix")
[8053:8053:1220/204633.631524:ERROR:sandbox_linux.cc(376)] InitializeSandbox() called with multiple threads in process gpu-process.
[8012:8105:1220/204633.665302:ERROR:object_proxy.cc(642)] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[8012:8105:1220/204633.665437:ERROR:object_proxy.cc(642)] Failed to call method: org.freedesktop.UPower.GetDisplayDevice: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[8012:8105:1220/204633.665551:ERROR:object_proxy.cc(642)] Failed to call method: org.freedesktop.UPower.EnumerateDevices: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[8012:8031:1220/204636.666514:ERROR:chrome_browser_main_extra_parts_metrics.cc(226)] crbug.com/1216328: Checking Bluetooth availability started. Please report if there is no report that this ends.
[8012:8031:1220/204636.666536:ERROR:chrome_browser_main_extra_parts_metrics.cc(229)] crbug.com/1216328: Checking Bluetooth availability ended.
[8012:8031:1220/204636.666544:ERROR:chrome_browser_main_extra_parts_metrics.cc(232)] crbug.com/1216328: Checking default browser status started. Please report if there is no report that this ends.
[8012:8031:1220/204636.680997:ERROR:chrome_browser_main_extra_parts_metrics.cc(236)] crbug.com/1216328: Checking default browser status ended.
The code I launch Chrome is as below:
const options = {
headless: false,
executablePath: '/usr/bin/google-chrome-stable',
dumpio: true,
args: [
'--autoplay-policy=no-user-gesture-required',
'--enable-usermedia-screen-capturing',
'--allow-http-screen-capture',
'--disable-infobars',
'--disable-dev-shm-usage',
'--disable-background-timer-throttling',
'--window-size=1344,1080',
'--unsafely-treat-insecure-origin-as-secure=http://127.0.0.1:3000',
'--no-sandbox',
'--disable-setuid-sandbox',
],
userDataDir: '/tmp/user-data-dir-instance-1'
}
const browser = await puppeteer.launch(options);
I have started Xvfb:
Xvfb :1 -screen 0 1344x1080x24 +extension RANDR &
and run index.ts which the code above in it to launch Chrome using the user root:
export DISPLAY=1 MODE=development && ts-node -T -P tsconfig.json src/service/video/index.ts
I am using puppeteer 13.0.0 and Chrome 96.0.4664.93.
Although Chrome has been launched successfully, those errors make me worried and I want to know what happened. Anyone have some idea about this? Thanks very much!

Connecting to CloudSQL Mysql over ssl from external application

I am trying to get a sample java application to connect to a Mysql gen2 instance I have in GCP. I use SSL and the ip address is whitelisted. I have confirmed connectivity to the instance using the mysql command line and passing in the client-cert.pem, client-key.pem and the server-ca.pem. Now inorder to connect to it from the spring boot java application, I did the following:
created a p12 file from the client cert and key and added it to keystore.jks
created a truststore with the server-ca.pem file.
Added this code in the main before the connection is created:
System.setProperty("javax.net.debug", "all");
System.setProperty("javax.net.ssl.trustStore", TRUST_STORE_PATH);
System.setProperty("javax.net.ssl.trustStorePassword", "fake_password");
System.setProperty("javax.net.ssl.keyStore", KEY_STORE_PATH);
System.setProperty("javax.net.ssl.keyStorePassword", "fake_password");
For the jdbc url, I used : jdbc:mysql://1.1.1.1:3306/sampledb?useSSL=true&requireSSL=true
However I am unable to connect to the instance and see this error from the java ssl debug:
restartedMain, RECV TLSv1.1 ALERT: fatal, unknown_ca
%% Invalidated: [Session-2, TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA]
restartedMain, called closeSocket()
restartedMain, handling exception: javax.net.ssl.SSLHandshakeException: Received fatal alert: unknown_ca
restartedMain, called close()
restartedMain, called closeInternal(true)
I also tried to run
openssl verify -CAfile server-ca.pem client-cert.pem`
and got this output:
error 20 at 0 depth lookup:unable to get local issuer certificate`
Any ideas on what I might be doing wrong?

Error creating a custom cartridge application in OpenShift

I'm trying to create a custom cartridge application on OpenShift using the command rhc -d create-app liferay htt..... An error is raised but I don't know where to find more specific information. What does this error mean and how do I fix it?
Creating application 'liferay' ... DEBUG: Creating application 'liferay' with these options - {:cartridges=>[#<RHC::Rest::Cartridge:0x007ff8f9354e00 #attributes={"url"=>"http...", "messages"=>[]}, #client=nil>]}
DEBUG: Adding application liferay to domain 546b3528ecb8d480bb000012
DEBUG: Using token authentication
DEBUG: Request POST https:...openshift.redhat.com/broker/rest/domain/catapp/applications
DEBUG: code 500 267521 ms
Unable to complete the requested operation due to: An invalid exit code (1) was returned from the server ex-std-node192.prod.rhcloud.com. This indicates an unexpected
problem during the execution of your request.
Reference ID: 4f4141b703879dd93b88b271f553ec1b
Try enabling HTTP_DEBUG:
HTTP_DEBUG=1 rhc -d create-app liferay htt....

Unable to obtain JDBC connection from datasource

I was trying to run the following command in gradle and it gave me the following error :
c:\gsoc\mifosx\mifosng-provider>gradle migrateTenantListDB -PdbName=mifosplatfor
m-tenants
Listening for transport dt_socket at address: 8005
:migrateTenantListDB FAILED
FAILURE: Build failed with an exception.
* Where:
Build file 'C:\gsoc\mifosx\mifosng-provider\build.gradle' line: 357
* What went wrong:
Execution failed for task ':flywayMigrate'.
> Unable to obtain Jdbc connection from DataSource
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug
option to get more log output.
BUILD FAILED
Total time: 13.843 secs
The script file is here and the line no. of error is shown as 357 but I dont know why it is showing me an error. Is it something about incorrect configuration in mysql server please help me out here:
script:
task migrateTenantListDB<<{
description="Migrates a Tenant List DB. Optionally can pass dbName. Defaults to 'mifosplatform-tenants' (Example: -PdbName=someDBname)"
def filePath = "filesystem:$projectDir" + System.properties['file.separator'] + '..' + System.properties['file.separator'] + 'mifosng-db' + System.properties['file.separator'] + 'migrations/list_db'
def tenantsDbName = 'mifosplatform-tenants';
if (rootProject.hasProperty("dbName")) {
tenantsDbName = rootProject.getProperty("dbName")
}
flyway.url= "jdbc:mysql://localhost:3306/$tenantsDbName"
flyway.locations= [filePath]
flywayMigrate.execute()
}
The gradle script for this project has got mysql password hard-coded to mysql. You need to set your localhost password to mysql and check the connection before trying this command.