Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read properties of undefined (reading 'Accept') #1121

Closed
phawxby opened this issue Nov 1, 2023 · 0 comments
Closed

TypeError: Cannot read properties of undefined (reading 'Accept') #1121

phawxby opened this issue Nov 1, 2023 · 0 comments

Comments

@phawxby
Copy link

phawxby commented Nov 1, 2023

https://github.com/middyjs/middy/blob/f6c152404d7c714b365ad60839ef3ea6b6d554eb/packages/http-response-serializer/index.js#L12C26-L12C26

It appears that normalizeHttpResponse() in the event of undefined or an empty object creates new objects and returns them. This function is relying on side effects for the changes so if new objects are created they're not seen. The result is that if an undefined object is passed in you get an error. It should probably be more like

request = normalizeHttpResponse(request);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants