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

Content-Encoding: Cannot read property 'some' of undefined #373

Closed
anthonyalmarza opened this issue Feb 16, 2021 · 2 comments
Closed

Content-Encoding: Cannot read property 'some' of undefined #373

anthonyalmarza opened this issue Feb 16, 2021 · 2 comments
Labels

Comments

@anthonyalmarza
Copy link

anthonyalmarza commented Feb 16, 2021

Hi, So I'm sometimes running into this issue where on the following line there is raising a runtime error where binarySettings.contentEncodings is undefined.
https://github.com/vendia/serverless-express/blob/mainline/src/is-binary.js#L10

I'm not sure how this is happening but I've followed the trail up to the following two links if that helps.
https://github.com/vendia/serverless-express/blob/mainline/src/proxy.js#L28
https://github.com/vendia/serverless-express/blob/mainline/src/index.js#L17-L22

The following is the stacktrace I'm getting back from my lambda function.

ERROR	Unhandled Promise Rejection 	
{
    "errorType": "Runtime.UnhandledPromiseRejection",
    "errorMessage": "TypeError: Cannot read property 'some' of undefined",
    "reason": {
        "errorType": "TypeError",
        "errorMessage": "Cannot read property 'some' of undefined",
        "stack": [
            "TypeError: Cannot read property 'some' of undefined",
            "    at /var/task/node_modules/.pnpm/@vendia/serverless-express@4.3.1/node_modules/@vendia/serverless-express/src/is-binary.js:10:40",
            "    at Array.some (<anonymous>)",
            "    at isContentEncodingBinary (/var/task/node_modules/.pnpm/@vendia/serverless-express@4.3.1/node_modules/@vendia/serverless-express/src/is-binary.js:10:6)",
            "    at isBinary (/var/task/node_modules/.pnpm/@vendia/serverless-express@4.3.1/node_modules/@vendia/serverless-express/src/is-binary.js:40:10)",
            "    at forwardResponse (/var/task/node_modules/.pnpm/@vendia/serverless-express@4.3.1/node_modules/@vendia/serverless-express/src/transport.js:17:27)",
            "    at forwardRequestToNodeServer (/var/task/node_modules/.pnpm/@vendia/serverless-express@4.3.1/node_modules/@vendia/serverless-express/src/transport.js:139:3)",
            "    at processTicksAndRejections (internal/process/task_queues.js:93:5)"
        ]
    },
    "promise": {},
    "stack": [
        "Runtime.UnhandledPromiseRejection: TypeError: Cannot read property 'some' of undefined",
        "    at process.<anonymous> (/var/runtime/index.js:35:15)",
        "    at process.emit (events.js:315:20)",
        "    at process.EventEmitter.emit (domain.js:467:12)",
        "    at processPromiseRejections (internal/process/promises.js:245:33)",
        "    at processTicksAndRejections (internal/process/task_queues.js:94:32)"
    ]
}

More context around this sometimes happening is that when I remove Accept-Encoding from the headers the error is not raised. Very confusing.

Any and all help on this issue would be much appreciated.

Package deps:

"dependencies": {
    "@vendia/serverless-express": "^4.3.1",
    "compression": "^1.7.4",
    "express": "^4.17.1",
    "express-validator": "^6.9.2",
    "helmet": "^4.4.1"
  },
@brett-vendia
Copy link
Contributor

Hi @anthonyalmarza, could you provide relevant parts from your Lambda handler? Are you setting binarySettings?

github-actions bot pushed a commit that referenced this issue Feb 18, 2021
## [4.3.2](v4.3.1...v4.3.2) (2021-02-18)

### Bug Fixes

* default contentEncodings and contentTypes to constants ([e0bd86e](e0bd86e)), closes [#373](#373)
* refactor proxy and add deprecation warnings ([d50b7e7](d50b7e7))
@github-actions
Copy link

🎉 This issue has been resolved in version 4.3.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

OneDev0411 added a commit to OneDev0411/serverless-express that referenced this issue Mar 16, 2023
## [4.3.2](CodeGenieApp/serverless-express@v4.3.1...v4.3.2) (2021-02-18)

### Bug Fixes

* default contentEncodings and contentTypes to constants ([e0bd86e](CodeGenieApp/serverless-express@e0bd86e)), closes [#373](CodeGenieApp/serverless-express#373)
* refactor proxy and add deprecation warnings ([d50b7e7](CodeGenieApp/serverless-express@d50b7e7))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants