Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Jul 25 2018 10:41
    dthuering commented #32
  • Jun 05 2018 13:59
    tbueno commented #32
  • Jan 19 2018 13:50
    fsenart commented #10
  • Jan 17 2018 18:03
    immesys commented #53
  • Jan 17 2018 17:43
    fsenart closed #39
  • Jan 17 2018 17:43
    fsenart commented #39
  • Jan 17 2018 17:41
    fsenart closed #49
  • Jan 17 2018 17:41
    fsenart commented #49
  • Jan 17 2018 17:40

    fsenart on master

    Deprecate the project (compare)

  • Jan 17 2018 17:36
    fsenart edited #53
  • Jan 17 2018 17:36
    fsenart edited #53
  • Jan 17 2018 17:35
    fsenart edited #53
  • Jan 17 2018 17:34
    lsuss commented #53
  • Jan 17 2018 17:31

    lsuss on master

    Add official Go runtime benchma… (compare)

  • Jan 17 2018 17:29
    kylevanek opened #10
  • Jan 16 2018 17:08
    fsenart commented #53
  • Jan 16 2018 17:07
    immesys opened #53
  • Jan 08 2018 05:27
    rchaser53 commented #51
  • Jan 07 2018 14:08
    fsenart closed #51
  • Jan 07 2018 14:08
    fsenart commented #51
Farzad Senart
@fsenart
Hi @minsikzzang first of all thx very much for your contribution. I will review your PR this weekend and merge it. It is very suitable :wink: as we try to provide the most extensive set of Lambda events to the community. If any remark, I will continue the discussion in the PR's thread.
minsikzzang
@minsikzzang
thanks :+1:
Farzad Senart
@fsenart
Thank you @minsikzzang
riccardo-89
@riccardo-89
Hi guys, I have been using the github.com/eawsy/aws-lambda-go-core package for quite a while now and is amazing, thanks for all the hard work on it. Just today, I have started to see weird errors (not in all executions) that alternate with successful calls:
An error occurred during JSON serialization of response: 'instancemethod' object has no attribute 'skipkeys'
Traceback (most recent call last):
File "/usr/lib64/python2.7/json/__init__.py", line 251, in dumps
sort_keys=sort_keys, **kw).encode(obj)
File "/usr/lib64/python2.7/json/encoder.py", line 207, in encode
chunks = self.iterencode(o, _one_shot=True)
File "/usr/lib64/python2.7/json/encoder.py", line 270, in iterencode
return _iterencode(o, 0)
File "/usr/lib64/python2.7/json/encoder.py", line 153, in __init__
self.skipkeys = skipkeys
AttributeError: 'instancemethod' object has no attribute 'skipkeys'
and this is another error:
Unable to parse client context: 'function' object has no attribute 'check_circular'
Traceback (most recent call last):
File "/usr/lib64/python2.7/json/__init__.py", line 339, in loads
return _default_decoder.decode(s)
File "/usr/lib64/python2.7/json/decoder.py", line 364, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib64/python2.7/json/encoder.py", line 222, in iterencode
if self.check_circular:
AttributeError: 'function' object has no attribute 'check_circular'
riccardo-89
@riccardo-89
not really sure on how to fix, since we have not got access to the python code
to give you a little bit more context, this is how my handlers are organised:
package main

import (
    "bitbucket.org/afg/go-lambda-io/apigatewayproxyevent"
    "github.com/eawsy/aws-lambda-go-core/service/lambda/runtime"
)

const (
    ROUTE_BILLING_LIST = "list"
)

var HandleApiGateway = apigatewayproxyevent.Middleware(ApiGatewayHandle)

func ApiGatewayHandle(event *apigatewayproxyevent.Event, ctx *runtime.Context) (interface{}, error) {
    switch event.Route {
    case ROUTE_BILLING_LIST:
        return BillingController(event)
    default:
        return event.Error(apigatewayproxyevent.NewErrRouteNotSupported(event.Route))
    }
}
riccardo-89
@riccardo-89
where "bitbucket.org/afg/go-lambda-io/apigatewayproxyevent" is a private library of mine that I use to map and marshal events (like you do here https://github.com/eawsy/aws-lambda-go-event but I needed some custom manipulation so I created my own marshallers for different events), and the Middleware is just a passthrough function where I use defer in order to catch any un-handled situation and handle telemetry before exit, in this way the may function ApiGatewayHandle remains clean. Everything worked till today, when I added the middleware, could be the culprit?
here is the Middleware:
// Middleware ...
func Middleware(handler func(event *Event, ctx *runtime.Context) (interface{}, error)) func(event *Event, ctx *runtime.Context) (interface{}, error) {

    // deferred
    return func(event *Event, ctx *runtime.Context) (interface{}, error) {

        setTelemetryClient(event, ctx)

        defer func() {
            r := recover()
            if r != nil { // in case of crash
                switch t := r.(type) {
                case string:
                    err := errors.New(t)
                    log.Println("is string")
                    log.Println(err)
                case error:
                    // debug.PrintStack()
                    err := t
                    log.Println("is error")
                    log.Println(err)
                    log.Println(string(debug.Stack()))
                default:
                    err := errors.New("unknown error")
                    log.Println(err)
                }
            } else { // run everytime before to terminate the process
                logger.LogJSON(event, "deferred event")
                event.Telemetry.TrackRequest(event.Env["AWS_LAMBDA_FUNCTION_NAME"], event.HTTPMethod, event.Path, event.RequestContext.RequestID, event.RequestStart, event.Duration(), event.Response.Code, event.IsSuccess())
                event.Telemetry.Channel().Flush()
            }
        }()

        return handler(event, ctx)
    }
}
will try few other tests to figure out, thanks a lot in advance for any help you are able to give, thanks
riccardo-89
@riccardo-89
yes as soon as I have removed the Middleware wrapper, those error stopped, would be nice to know the cause of it, please let me know if you spot it, thanks :)
riccardo-89
@riccardo-89
I have tried without removing the middleware, but this time I have removed the telemetry lib from it, and it does work so I think the issue is in the telemetry lib itself
Lionel Suss
@lsuss
Hi @riccardo-89 , thank you for your feedback ;)
did you saw this error comming up after a new deployement of your lambda ?
TelemetryClient is a 3rd party lib ?
if yes, please share the github repo
Farzad Senart
@fsenart
And can you please give the output of the following command: docker run --rm eawsy/aws-lambda-go-shim version.
PS: If your libs (telemetry, etc), use goroutines in a way not suitable for Lambda then you can have very weird errors.
riccardo-89
@riccardo-89
Hi guys, thanks for the quick response
sure thing, this is the telemetry library I am trying to use https://github.com/Microsoft/ApplicationInsights-Go
and this is the output given by the command: 2017-10-05T07:09:02Z
I can see they do use channels heavily
yes the error came after a new deployment
riccardo-89
@riccardo-89
thanks a lot for your help guys, atm I am just removing all the parts of that library that are not needed and make my own to avoid these kind of issues, thanks
Farzad Senart
@fsenart
@riccardo-89 update your docker image so you have the latest version (some bugs of golang have been fixed in the last images). And for the go routine parts, if goroutines are not finished before the lambda returns then unexpected things can happen. So yes, see in your side and we are here if you need any further help. If your problem persists we may come with a private group to exchange more info and assist you more effectively.
riccardo-89
@riccardo-89
@fsenart will do! yes you are right it should be something related to unfinished task at this point since I can see not all the telemetry are tracked correctly, thanks a lot for you disponibility and help, you have already done a lot building this lib I would feel guilty to ask for more of your time, really appreciated the thought, thanks :)
minsikzzang
@minsikzzang
@lsuss You comments have been addressed :) and added new PR for adding Response in apigatwayproxyevt
Lionel Suss
@lsuss
great work ;)
minsikzzang
@minsikzzang
;)
Lionel Suss
@lsuss
I just added another comment on your first PR
minsikzzang
@minsikzzang
ok np
will have a look asap
Lionel Suss
@lsuss
:+1:
I'm merging the other one ;)
minsikzzang
@minsikzzang
@lsuss README.md was added
Lionel Suss
@lsuss
@minsikzzang just update the main README.md, to link to your event ;)
minsikzzang
@minsikzzang
ah ha
@lsuss should be sorted :)
minsikzzang
@minsikzzang
thanks for merging :) :+1: @lsuss
Lionel Suss
@lsuss
@minsikzzang GZ your event is in da place haha :fireworks:
minsikzzang
@minsikzzang
:sparkles:
Sean Parsons
@seanpar203
If I change the PACKAGE variable inside the MakeFile shouldn't that then look for the new packageName.zip ?
Instead of looking for package.zip
ENOENT: no such file or directory, open 'package.zip'
my zip file is called handler.zip
Farzad Senart
@fsenart
You should do something like PACKAGE=packageName make so that it outputs packageName.zip
Sean Parsons
@seanpar203
Well it is outputting the .zip file I specified but when I run make deploy it's still looking for package.zip