Git Product home page Git Product logo

Comments (3)

srisco avatar srisco commented on August 11, 2024

Hi @swarnim-cn,
thank you for using SCAR, you can send a JSON object through API Gateway by sending it in the GET body. SCAR automatically saves the body as a file that will be reachable from the INPUT_FILE_PATH in the script.

To store results you can create a new file in the TMP_OUTPUT_DIR that will be uploaded to your configured S3 output bucket or, if you want to get the result directly from the HTTP request, you can simply do a cat /result/file in your script, but remember the limitations and that the result will be encoded in base64. Documentation will be updated soon to clarify these use cases.

I hope I've been helpful. I would appreciate if you could provide me some information about the use case you want to run with SCAR, as this project is part of my doctoral thesis and I need to collect information about its usage.

Regards.

from scar.

swarnim-cn avatar swarnim-cn commented on August 11, 2024

Hi @srisco

I have mailed you regarding this on your @i3m.upv.es email id. Kindly check

Regards

from scar.

swarnim-cn avatar swarnim-cn commented on August 11, 2024

@srisco
I tried doing this in two manners:

using the -jd flag ->
I invoked the lambda function in this manner scar invoke -f test.yaml -jd '{"Name":"John", "Age"=22}' . However, in my event object, this data is not in the form of json. The corresponding event object is this ->
{'resource': '/{proxy+}', 'path': '/launch', 'httpMethod': 'POST', 'headers': {'Accept': '/', 'Accept-Encoding': 'gzip, deflate', 'Content-Type': 'application/json', 'Host': 'iasduhvi21.execute-api.us-east-1.amazonaws.com', 'User-Agent': 'python-requests/2.23.0', 'X-Amzn-Trace-Id': 'Root=1-5ef22967-3f07d90438506b1459e474f3', 'X-Forwarded-For': '223.225.226.3', 'X-Forwarded-Port': '443', 'X-Forwarded-Proto': 'https'}, 'multiValueHeaders': {'Accept': ['/'], 'Accept-Encoding': ['gzip, deflate'], 'Content-Type': ['application/json'], 'Host': ['iasduhvi21.execute-api.us-east-1.amazonaws.com'], 'User-Agent': ['python-requests/2.23.0'], 'X-Amzn-Trace-Id': ['Root=1-5ef22967-3f07d90438506b1459e474f3'], 'X-Forwarded-For': ['223.225.226.3'], 'X-Forwarded-Port': ['443'], 'X-Forwarded-Proto': ['https']}, 'queryStringParameters': None, 'multiValueQueryStringParameters': None, 'pathParameters': {'proxy': 'launch'}, 'stageVariables': None, 'requestContext': {'resourceId': '81opwu', 'resourcePath': '/{proxy+}', 'httpMethod': 'POST', 'extendedRequestId': 'OltoQHTTIAMFccQ=', 'requestTime': '23/Jun/2020:16:10:15 +0000', 'path': '/scar/launch', 'accountId': '069379984339', 'protocol': 'HTTP/1.1', 'stage': 'scar', 'domainPrefix': 'iasduhvi21', 'requestTimeEpoch': 1592928615966, 'requestId': '25828803-6a7e-41f5-99bd-cc119eb229c9', 'identity': {'cognitoIdentityPoolId': None, 'accountId': None, 'cognitoIdentityId': None, 'caller': None, 'sourceIp': '223.225.226.3', 'principalOrgId': None, 'accessKey': None, 'cognitoAuthenticationType': None, 'cognitoAuthenticationProvider': None, 'userArn': None, 'userAgent': 'python-requests/2.23.0', 'user': None}, 'domainName': 'iasduhvi21.execute-api.us-east-1.amazonaws.com', 'apiId': 'iasduhvi21'}, 'body': 'Name=John&Age=22', 'isBase64Encoded': False}

In this, the 'body' is not in json format hence it's giving me an error while executing the lambda function. 'body': 'Name=John&Age=22' is not json format.

Using the -p flag ->
I invoked the lambda function in this manner scar invoke -f test.yaml -jd '{"Name":"John", "Age"=22}'. This was in the correct json format. But when I checked the file corresponding to INPUT_FILE_PATH there is nothing there so I was not able to extract these parameters.

from scar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.