Using AWS CLI
aws --version
aws-cli/1.11.21 Python/2.7.12 Darwin/15.3.0 botocore/1.4.78
Creating a POST method for API Gateway as explained at https://github.com/arun-gupta/serverless/tree/master/aws/microservice#post-method. This method can be invoked successfully using test-invoke-method and AWS Console.
Creating a GET method using AWS CLI https://github.com/arun-gupta/serverless/tree/master/aws/microservice#get-method. Invoking this method using test-invoke-method and AWS Console gives the following error:
{
"status": 500,
"body": "{\"message\": \"Internal server error\"}",
"log": "Execution log for request test-request\nThu Dec 29 00:58:56 UTC 2016 : Starting execution for request: test-invoke-request\nThu Dec 29 00:58:56 UTC 2016 : HTTP Method: GET, Resource Path: /books\nThu Dec 29 00:58:56 UTC 2016 : Method request path: {}\nThu Dec 29 00:58:56 UTC 2016 : Method request query string: {}\nThu Dec 29 00:58:56 UTC 2016 : Method request headers: {}\nThu Dec 29 00:58:56 UTC 2016 : Method request body before transformations: \nThu Dec 29 00:58:56 UTC 2016 : Endpoint request URI: https://lambda.us-west-1.amazonaws.com/2015-03-31/functions/arn:aws:lambda:us-west-1:598307997273:function:MicroserviceGetAll/invocations\nThu Dec 29 00:58:56 UTC 2016 : Endpoint request headers: {x-amzn-lambda-integration-tag=test-request, Authorization=******************************************************************************************************************************************************************************************************************************************************************************************************482377, X-Amz-Date=20161229T005856Z, x-amzn-apigateway-api-id=sofl9ilki7, X-Amz-Source-Arn=arn:aws:execute-api:us-west-1:598307997273:sofl9ilki7/null/GET/books, Accept=application/json, User-Agent=AmazonAPIGateway_sofl9ilki7, Host=lambda.us-west-1.amazonaws.com, X-Amzn-Trace-Id=Root=1-58645fd0-7d733ae3c383f4378fcc0338}\nThu Dec 29 00:58:56 UTC 2016 : Endpoint request body after transformations: \nThu Dec 29 00:58:56 UTC 2016 : Endpoint response body before transformations: <AccessDeniedException>\n <Message>Unable to determine service/operation name to be authorized</Message>\n</AccessDeniedException>\n\nThu Dec 29 00:58:56 UTC 2016 : Endpoint response headers: {x-amzn-RequestId=f95a8659-cd61-11e6-80f6-ddd6ce5b7e8b, Connection=keep-alive, Content-Length=130, Date=Thu, 29 Dec 2016 00:58:56 GMT}\nThu Dec 29 00:58:56 UTC 2016 : Lambda invocation failed with status: 403\nThu Dec 29 00:58:56 UTC 2016 : Execution failed due to configuration error: \nThu Dec 29 00:58:56 UTC 2016 : Method completed with status: 500\n",
"latency": 39
}
The ARN identified in the error message is arn:aws:execute-api:us-west-1:598307997273:sofl9ilki7/null/GET/books. Wondering if null instead of test is causing this to fail?
I think you are using "GET" for your Lambda function endpoint on your GET method as well. Please change it to use "POST" for the Lambda integration HTTP method.
Using GET for lambda integrations on AWS API Gateway may leave you wondering why POST integrations are working but GET integrations don't work. GET AWS_PROXY integrations will fail if GET is used as the method on the integration. POST should be used for the lambda integration, even if the OPEN API specification is for a get method.
To invoke a lambda function the http method should be POST as per the lambda API:
Visit http://docs.aws.amazon.com/lambda/latest/dg/API_Invoke.html.
The null in the source ARN is because test-invoke does not have a stage to associate with your API. This is not usually a problem, unless the policy on your Lambda function is expecting an incompatible source ARN. Check the policy on your Lambda function and see if it includes a restriction on the source ARN. If it does, edit it to be compatible with the test-invoke ARN or deploy the API to a stage and call the method directly without test-invoke.
Note carefully API Gateway use POST method by to call Lambda, while allowing any method to be able to call it via x-amazon-apigateway-any-method.
Related
I'm currently upgrading an application that uses DB2/400 database, and I'm migrating to the new java time api (LocalDate, LocalTime, ...), using the latest version of jt400.jar.
However, when executing statement setObject as follows
stmt.setObject(++columns, LocalDate.now());
I'm getting this exception
Thread[main,5,main] Ter jan 18 10:46:56:852 GMT 2022 as400: PreparedStatementImpl STMT0001 (1588970020) : setObject().
Thread[main,5,main] Ter jan 18 10:46:56:852 GMT 2022 as400: PreparedStatementImpl STMT0001 (1588970020) : parameter index: 2 type: java.time.LocalDate toString():2022-01-18.
Thread[main,5,main] Ter jan 18 10:46:56:853 GMT 2022 as400: Unknown com.ibm.as400.access.SQLDate#3c679bde (1013423070) : Unable to assign object(2022-01-18) of class(class java.time.LocalDate).
Thread[main,5,main] Ter jan 18 10:46:56:853 GMT 2022 as400: Unknown com.ibm.as400.access.SQLDate#3c679bde (1013423070) : Throwing exception, sqlState: 07006 reason: Data type mismatch. vendor code -99999.java.sql.SQLException: Data type mismatch.
at com.ibm.as400.access.JDError.createSQLExceptionSubClass(JDError.java:891)
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:436)
at com.ibm.as400.access.SQLDate.set(SQLDate.java:452)
at com.ibm.as400.access.AS400JDBCPreparedStatementImpl.setValue(AS400JDBCPreparedStatementImpl.java:3655)
at com.ibm.as400.access.AS400JDBCPreparedStatementImpl.setObject(AS400JDBCPreparedStatementImpl.java:3124)
at mypackage.jdbc.LocalDateTester.main(LocalDateTester.java:26)
Also, when trying to read from the DB using
rs.getObject(2, LocalDate.class)
I'm also getting the exception
Exception in thread "main" java.sql.SQLException: Data type not valid.
at com.ibm.as400.access.JDError.createSQLExceptionSubClass(JDError.java:985)
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:436)
at com.ibm.as400.access.JDError.throwSQLException(JDError.java:413)
at com.ibm.as400.access.AS400JDBCResultSet.getObject(AS400JDBCResultSet.java:7457)
at mypackage.jdbc.LocalDateTester.main(LocalDateTester.java:47)
The DB column type on iSeries is Date.
I'm I doing something wrong, or is the new java.time api not supported?
If so, does anyone know if there are any plans for Java Time API support?
Thanks in advance
You must use java.sql.date with JDBC. Convert with :
java.sql.Date.valueOf(LocalDate.now());
I have written a simple expression transformation where the mapping concatenates the first and last name and based on salary of the customer it stores the string high,low or medium into the target table.
The workflow is validated and there are no errors. But when the workflow is started it reads the rows from the database and then applies the transformation and then tries to load the target table. Here while loading the data into the target table it doesn't move forward and gets struck and after long time when Integration service gets disconnected it throws a repository error.
The interesting thing is when I run some other workflows it doesn't give any error. Below are the session logs:
<pre><code>
DIRECTOR> TM_6014 Initializing session [s_mp_person_exp_person] at [Thu Feb
18 22:21:21 2016].
DIRECTOR> TM_6683 Repository Name: [infa_training]
DIRECTOR> TM_6684 Server Name: [infa_training_IS]
DIRECTOR> TM_6686 Folder: [training]
DIRECTOR> TM_6685 Workflow: [wf_person_exp_person] Run Instance Name: [] Run Id: [38]
DIRECTOR> TM_6101 Mapping name: mp_person_exp_person.
DIRECTOR> TM_6964 Date format for the Session is [MM/DD/YYYY HH24:MI:SS.US]
DIRECTOR> TM_6708 Using configuration property [EnableDataEncryption,no]
DIRECTOR> TM_6708 Using configuration property [StoreHAPersistenceInDB,no]
DIRECTOR> TM_6703 Session [s_mp_person_exp_person] is run by 64-bit Integration Service [node01_Gizmo], version [9.6.1], build [0606].
MANAGER> PETL_24058 Running Partition Group [1].
MANAGER> PETL_24000 Parallel Pipeline Engine initializing.
MANAGER> PETL_24001 Parallel Pipeline Engine running.
MANAGER> PETL_24003 Initializing session run.
MAPPING> CMN_1569 Server Mode: [ASCII]
MAPPING> CMN_1570 Server Code page: [MS Windows Latin 1 (ANSI), superset of Latin1]
MAPPING> TM_6151 The session sort order is [Binary].
MAPPING> TM_6156 Using low precision processing.
MAPPING> TM_6180 Deadlock retry logic will not be implemented.
MAPPING> TM_6187 Session target-based commit interval is [10000].
MAPPING> TM_6307 DTM error log disabled.
MAPPING> TE_7022 TShmWriter: Initialized
MAPPING> TM_6007 DTM initialized successfully for session [s_mp_person_exp_person]
DIRECTOR> PETL_24033 All DTM Connection Info: [<NONE>].
MANAGER> PETL_24004 Starting pre-session tasks. : (Thu Feb 18 22:21:21 2016)
MANAGER> PETL_24027 Pre-session task completed successfully. : (Thu Feb 18 22:21:21 2016)
DIRECTOR> PETL_24006 Starting data movement.
MAPPING> TM_6660 Total Buffer Pool size is 1219648 bytes and Block size is 65536 bytes.
READER_1_1_1> DBG_21438 Reader: Source is [orcl], user [kakarrot]
READER_1_1_1> BLKR_16003 Initialization completed successfully.
WRITER_1_*_1> WRT_8147 Writer: Target is database [orcl], user [target], bulk mode [OFF]
WRITER_1_*_1> WRT_8124 Target Table PERSON :SQL INSERT statement:
INSERT INTO PERSON(ID,FULLNAME,TOTALSAL,ANNUALSAL,CITY,STATE,MOB,SALSTATUS) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?)
WRITER_1_*_1> WRT_8124 Target Table PERSON :SQL UPDATE statement:
UPDATE PERSON SET FULLNAME = ?, TOTALSAL = ?, ANNUALSAL = ?, CITY = ?, STATE = ?, MOB = ?, SALSTATUS = ? WHERE ID = ?
WRITER_1_*_1> WRT_8124 Target Table PERSON :SQL DELETE statement:
DELETE FROM PERSON WHERE ID = ?
WRITER_1_*_1> WRT_8270 Target connection group #1 consists of target(s) [PERSON]
WRITER_1_*_1> WRT_8003 Writer initialization complete.
READER_1_1_1> BLKR_16007 Reader run started.
WRITER_1_*_1> WRT_8005 Writer run started.
WRITER_1_*_1> WRT_8158
*****START LOAD SESSION*****
Load Start Time: Thu Feb 18 22:21:21 2016
Target tables:
PERSON
READER_1_1_1> RR_4010 SQ instance [SQ_PERSON] SQL Query [SELECT kakarrot.Person.ID, kakarrot.Person.FNAME, kakarrot.Person.LNAME, kakarrot.Person.SALPERMONTH, kakarrot.Person.COMMISION, kakarrot.Person.CITY, kakarrot.Person.STATE, kakarrot.Person.MOB FROM kakarrot.Person]
READER_1_1_1> RR_4049 SQL Query issued to database : (Thu Feb 18 22:21:21 2016)
READER_1_1_1> RR_4050 First row returned from database to reader : (Thu Feb 18 22:21:21 2016)
READER_1_1_1> BLKR_16019 Read [6] rows, read [0] error rows for source table [Person] instance name [PERSON]
READER_1_1_1> BLKR_16008 Reader run completed.
TRANSF_1_1_1> DBG_21216 Finished transformations for Source Qualifier [SQ_PERSON]. Total errors [0]
WRITER_1_*_1> WRT_8167 Start loading table [PERSON] at: Thu Feb 18 22:21:21 2016
CMN_1761 Timestamp Event: [Fri Feb 19 08:01:22 2016]
REP_12014 An error occurred while accessing the repository
CMN_1761 Timestamp Event: [Fri Feb 19 08:01:23 2016]
REP_12400 Repository Error (Connection to the Repository Service [infa_training] is broken.)
CMN_1761 Timestamp Event: [Fri Feb 19 08:01:23 2016]
REP_12400 Repository Error ([REP_55101] Connection to the Repository Service [infa_training] is broken.)
CMN_1761 Timestamp Event: [Fri Feb 19 08:01:23 2016]
REP_12400 Repository Error ([REP_55114] Reconnecting to the Repository Service [infa_training]. The resilience time is 180 seconds.)
CMN_1761 Timestamp Event: [Fri Feb 19 08:01:50 2016]
REP_12400 Repository Error ([REP_51490] Communication with client application on host [169.254.164.2] and port [6013] has failed because of network errors. [System Error (errno = 10054): Unknown error].)
CMN_1761 Timestamp Event: [Fri Feb 19 10:00:14 2016]
REP_12400 Repository Error ([REP_55112] Unable to connect to the Repository Service [infa_training] since the resilience time is up.)
CMN_1761 Timestamp Event: [Fri Feb 19 10:00:14 2016]
REP_12400 Repository Error (Failed to connect to repository service [infa_training].)
CMN_1761 Timestamp Event: [Fri Feb 19 10:00:14 2016]
REP_12014 An error occurred while accessing the repository
CMN_1761 Timestamp Event: [Fri Feb 19 10:00:14 2016]
REP_12400 Repository Error (Failed to connect to repository service [infa_training].)
CMN_1761 Timestamp Event: [Fri Feb 19 10:00:14 2016]
REP_12400 Repository Error ([REP_55102] Failed to connect to repository service [infa_training].)
CMN_1761 Timestamp Event: [Fri Feb 19 10:00:15 2016]
PETL_24074 Failed to send updates to the master service process. Session run
`will be terminated.`
</pre></code>
Hope you guys can shed light on this problem.
The issue definitely appears to be with the database. According to your log, the session hung for 10 hours and then seems to have lost its connection to the repository database as well. You should try changing the target connection to a flat file and/or any other database you have access to in order to test the session itself. Also, if you don't have the ability to do it yourself, you should ask a DBA to look at the session as it is running to see why the oracle connection is waiting/hung up.
I am using elasticdump to dump data from local machine to the server. But my dumps always ended with this error:
...
Tue, 20 Oct 2015 22:56:35 GMT | sent 100 objects to destination elasticsearch, wrote 100
Tue, 20 Oct 2015 22:56:35 GMT | got 100 objects from source elasticsearch (offset: 21200)
Tue, 20 Oct 2015 22:56:36 GMT | Error Emitted => read ECONNRESET
Tue, 20 Oct 2015 22:56:36 GMT | Total Writes: 21200
Tue, 20 Oct 2015 22:56:36 GMT | dump ended with error (set phase) => Error: read ECONNRESET
...
How should I solve this problem?
Is there a better way to dump data from local machine to the server? Thanks in advance!
It sounds like your issue is being caused by the elasticdump opening too many sockets to your elasticsearch cluster. You can use the --maxSockets option to limit the number of sockets opened.
For example:
$ elasticdump --input http://192.168.2.222:9200/index1 --output http://192.168.2.222:9200/index2 --type=data --maxSockets=5
You can find a detailed explanation of the issue here:
https://github.com/taskrabbit/elasticsearch-dump/issues/98
I'm trying to hit a service. I am able to see the response in the http log. I see success message in the soapUI Log. But in the soap response i see the http 404 error.
In the http log.. at the end.. it is showing
Thu Jul 30 15:00:01 IST 2015:DEBUG:<< "Connection: Close[\r][\n]"
Thu Jul 30 15:00:01 IST 2015:DEBUG:<< "Date: Thu, 30 Jul 2015 09:30:00 GMT[\r][\n]"
Thu Jul 30 15:00:01 IST 2015:DEBUG:<< "Server: WebSphere Application Server/8.0[\r][\n]"
Thu Jul 30 15:00:01 IST 2015:DEBUG:<< "[\r][\n]"
Thu Jul 30 15:00:01 IST 2015:DEBUG:<< "Error 404: com.ibm.ws.webcontainer.servlet.exception.NoTargetForURIException: No target servlet configured for uri: /myService
I'm trying to use this service response. I need this response, to run my code.
Please help in showing up the response on the Soap response column instead of http log.
It seems that application myService is not deployed on the application server. What is the name of application? myService or MyService?
Today I configured a basic tinyproxy.
I expected it to act as proxy for ubuntu repositories.
But when trying to download stuff from repositories I got this on tinyproxy log
CONNECT Mar 27 17:30:46 [20348]: Connect (file descriptor 9): [unknown] [192.168.2.30]
CONNECT Mar 27 17:30:46 [20348]: Request (file descriptor 9): GET http://br.archive.ubuntu.com/ubuntu/pool/main/t/tdb/python-tdb_1.2.12-1_amd64.deb HTTP/1.1
INFO Mar 27 17:30:46 [20348]: No upstream proxy for br.archive.ubuntu.com
ERROR Mar 27 17:30:56 [20348]: opensock: Could not retrieve info for br.archive.ubuntu.com
INFO Mar 27 17:30:56 [20348]: no entity
I stuck on some misconcept. Do not tinyproxy send requests for outside servers directly?
I supllied an external proxy server to fix this
upstream 117.79.64.29:80