Unanswered Questions tagged with AWS Lambda

Content language: English

Sort by most recent

Browse through the questions and answers listed below or filter and sort to narrow down your results.

Lambda deploy from Eclipse not working: JAXBException

Hello, - - I could not run option: AWS Toolkit for Eclipse -> Upload function to AWS Lambda, on eclipse jee-2021-09, Version: 2021-09 (4.21.0), Build id: 20210910-1417 - The archive is created on local drive, but it is not uploaded; so, the jaxb issue is not related to archive internals, but to some aws-eclipse interraction - AWS Explorer is working - Eclipse error: An internal error occurred during: "Uploading function code to Lambda": javax/xml/bind/JAXBException - I looked for solutions in the internet but they did not worked (seams that is a java version deprecation of jaxb) - Where from should I get the jaxb package and dependencies (please add link to work with com.amazonaws.eclipse.javasdk) and how should I add them to Eclipse ? - Full error stack: java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException at com.amazonaws.util.Md5Utils.md5AsBase64(Md5Utils.java:104) at com.amazonaws.services.s3.AmazonS3Client.putObject(AmazonS3Client.java:1647) at com.amazonaws.eclipse.lambda.upload.wizard.util.UploadFunctionUtil.performFunctionUpload(UploadFunctionUtil.java:95) at com.amazonaws.eclipse.lambda.upload.wizard.UploadFunctionWizard.doFinish(UploadFunctionWizard.java:111) at com.amazonaws.eclipse.core.plugin.AbstractAwsJobWizard$1.run(AbstractAwsJobWizard.java:35) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63) Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException cannot be found by com.amazonaws.eclipse.javasdk_1.11.248 at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:511) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:422) at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:414) at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:153) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 6 more Thanks a lot for answer, Mihai
0
answers
0
votes
25
views
asked 3 days ago

How to know if my Lambda Authorizer for API Gateway is caching results?

I have a Lambda Authorizer for an API Gateway API with one resource and three methods - PUT / GET / DELETE. Each method uses the same Lambda Authorizer, the TOKEN kind, to verify a JWT from Cognito. An IAM policy is returned by the Lambda which allows PUT / GET / DELETE actions on the resource. The authorization and policy work fine -- I just don't know if the result is being cached by API Gateway. When I look at the API Gateway execution logs, every request seems to be calling the Lambda Authorizer. Every API Gateway execution log has a line like this: ``` Sending request to https://lambda.us-east-1.amazonaws.com/2015-03-31/functions/arn:aws:lambda:us-east-1:123456789012:function:MY_LAMBDA_FUNCTION:prod/invocations ``` **Does this invocation of the Lambda function mean that the Lambda Authorizer is not caching properly?** After the "Sending request" log line, there's a line like "Authorizer result body before parsing" and then this line: ``` Using valid authorizer policy for principal: *****user ``` **Does this statement indicate that the Lambda Authorizer using a cached policy?** The strange thing is...when I check the Lambda logs, the execution times vary wildly, almost as if the Lambda itself is caching the result...but I think the caching happens on the API Gateway side? What's going on here? Sample of Lambda duration times: 529ms, 10ms, 217ms, 213ms, 8ms, 2ms
0
answers
0
votes
26
views
profile picture
asked 5 days ago

AWS Parameters and Secrets Lambda Extension does not work with parameter ARN's

The [AWS documentation](https://docs.aws.amazon.com/systems-manager/latest/userguide/ps-integration-lambda-extensions.html#sample-commands-ps) for the Parameters and Secrets Lambda Extension states: ``` To make a call using the Amazon Resource Name (ARN) for a parameter, make an HTTP GET call similar to the following. GET http://localhost:port/systemsmanager/parameters/get?name=arn:aws:ssm:us-east-1:123456789012:parameter/MyParameter ``` however these requests return a 400 stating the parameter name is invalid. Here's a quick example to demonstrate the successful request using the parameter name, and the failed request using the parameter ARN: ```py import json import os from botocore.vendored import requests def lambda_handler(event, context): name_url = 'http://localhost:2773/systemsmanager/parameters/get?name=test-param' arn_url = 'http://localhost:2773/systemsmanager/parameters/get?name=arn:aws:ssm:us-east-2:{ACCOUNT_ID}:parameter/test-param' headers = {'X-Aws-Parameters-Secrets-Token': os.environ['AWS_SESSION_TOKEN']} name_resp = requests.get(name_url, headers=headers) print(f'NAME RESPONSE: {name_resp.status_code} > {name_resp.text}') arn_resp = requests.get(arn_url, headers=headers) print(f'ARN RESPONSE: {arn_resp.status_code} > {arn_resp.text}') ``` and the output: ``` NAME RESPONSE: 200 > {"Parameter":{"ARN":"arn:aws:ssm:us-east-2:{ACCOUNT_ID}:parameter/test-param","DataType":"text","LastModifiedDate":"2022-11-26T02:25:14.669Z","Name":"test-param","Selector":null,"SourceResult":null,"Type":"SecureString","Value":"AQICAH....=","Version":2},"ResultMetadata":{}} ARN RESPONSE: 400 > an unexpected error occurred while executing request [AWS Parameters and Secrets Lambda Extension] 2022/11/26 18:09:36 ERROR GetParameter request encountered an error: operation error SSM: GetParameter, https response error StatusCode: 400, RequestID: {REQUEST_ID}, api error ValidationException: Invalid parameter name. Please use correct syntax for referencing a version/label <name>:<version/label> ``` The docs also state: ``` When using GET calls, parameter values must be encoded for HTTP to preserve special characters. ``` however the error still occurs whether the ARN colons and/or slash are URL-encoded or not like so: ``` http://localhost:2773/systemsmanager/parameters/get?name=arn%3Aaws%3Assm%3Aus-east-2%3A{ACCOUNT_ID}%3Aparameter/test-param http://localhost:2773/systemsmanager/parameters/get?name=arn%3Aaws%3Assm%3Aus-east-2%3A{ACCOUNT_ID}%3Aparameter%2Ftest-param ``` Am I missing something here or is the documentation incorrect in that an ARN can be used for these requests?
0
answers
0
votes
63
views
andy
asked 12 days ago