Skip to content

Serialize/deserialize Context  #260

@rimutaka

Description

@rimutaka

I'd like enable serialization / deserialization of Context to enable passing off handler's input/output for remote execution over the network.

I use a proxy handler that sends the request to AWS SQS queue and then reads a response from another queue. It acts as a proxy for the actual lambda running on my laptop. It's a very handy way of debugging it locally while being fully plugged into the AWS workflow. A more detailed explanation is in https://github.com/rimutaka/lambda-debug-proxy and https://dev.to/rimutaka/debugging-lambdas-on-aws-from-your-local-computer-4j59.

The changes are superficial:

  • added Config to Context (gotta be done anyway)
  • added Serialize, Deserialize to Config and Context
  • replaced ? with expect() with detailed error messages in the affected lines of code

Full diff: master...rimutaka:proxy-experiment

Branch with the changes: https://github.com/rimutaka/aws-lambda-rust-runtime/tree/proxy-experiment

This change is unlikely to benefit anyone outside of this specific use case, so it would be logical to make it a feature, but the amount of code added by the compiler is minimal, sometime negative. I tested this by compiling our examples for release.

Example proxy master diff
basic 6506808 6520728 -13,920
error-handling 6612224 6633936 -21,712
hello-http 6736936 6730992 5,944
hello-http-without-macros 6755200 6748960 6,240
macro 6450784 6460960 -10,176

I am at a loss why some builds from proxy branch are smaller than master when they have Ser/Deser in them. What I know is that I've been using this proxy branch for weeks with no problems. What did I miss?

The proxy branch is ahead of master and is based on PR #244, so it cannot be merged. I am maintaining it in my own fork and will open a new PR once #244 is resolved. This issue is just for the record.

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions