Skip to content

Discussion: Python 3.10 AttributeError: 'dict' object has no attribute 'header_serializer' #2028

Closed
@heitorlessa

Description

@heitorlessa

Discussed in #2022

Originally posted by raulroscode March 17, 2023
Hello, I have updated my runtime python version to 3.10 and I'm getting this error:

AttributeError: 'dict' object has no attribute 'header_serializer'.


cors = <aws_lambda_powertools.event_handler.api_gateway.CORSConfig object at 0x127ec6800>

    def build(self, event: BaseProxyEvent, cors: Optional[CORSConfig] = None) -> Dict[str, Any]:
        """Build the full response dict to be returned by the lambda"""
        self._route(event, cors)
    
        if isinstance(self.response.body, bytes):
            logger.debug("Encoding bytes response with base64")
            self.response.base64_encoded = True
            self.response.body = base64.b64encode(self.response.body).decode()
    
        return {
            "statusCode": self.response.status_code,
            "body": self.response.body,
            "isBase64Encoded": self.response.base64_encoded,
          **event.header_serializer().serialize(headers=self.response.headers, cookies=self.response.cookies),
        }
      AttributeError: 'dict' object has no attribute 'header_serializer'
venv/lib/python3.10/site-packages/aws_lambda_powertools/event_handler/api_gateway.py:252: AttributeError

I think that aws-lambda-powertools only supports until python 3.9. Should it work with python 3.10?. Do you know when it will be available for python 3.10 and/or 3.11?

Thanks.

Metadata

Metadata

Labels

feature-requestfeature requesthelp wantedCould use a second pair of eyes/hands

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions