Skip to content
This repository was archived by the owner on May 21, 2025. It is now read-only.
This repository was archived by the owner on May 21, 2025. It is now read-only.

Unable to read requestContext data from event in fiber #158

Open
@Shahab96

Description

@Shahab96

I'm currently using fiber for my app and have a handler which will be given data passed through by a custom auth lambda. I am unable to access the lambda event from within my handler however. I'm currently using ProxyWithContextV2 to run my app, but I can't seem to find a way to extract the event data from within the handler.

func init() {
	log.Printf("Cold start.")

	app = fiber.New()

	app.Post("/auth/login", routes.Login)
	app.Post("/auth/register", routes.Register)
	app.Post("/auth/logout", routes.Logout)
	fiberLambda = fiberadapter.New(app)
}

func handler(ctx context.Context, req events.APIGatewayV2HTTPRequest) (events.APIGatewayV2HTTPResponse, error) {
	return fiberLambda.ProxyWithContextV2(ctx, req)
}

func main() {
	if os.Getenv("AWS_EXECUTION_ENV") == "AWS_Lambda_go1.x" {
		lambda.Start(handler)
	} else {
		app.Listen(":3000")
	}
}
func Logout(c *fiber.Ctx) error {
  // Need to get the event.requestContext.authorizer here
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions