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

"Cannot read property 'length' of undefined" error when there is no message is SQS queue #14

Open
georgesbiaux opened this issue Aug 30, 2021 · 1 comment

Comments

@georgesbiaux
Copy link

georgesbiaux commented Aug 30, 2021

Hi :)

When calling the getEvents and that no message is present in the queue (because no events made is to EventBridge), instead of returning an empty array, or throwing a clear exception, I get:

    TypeError: Cannot read property 'length' of undefined
        at EventBridge.getEvents (/Users/georgesbiaux/Projects/Pyxo/pyxo/backend/node_modules/sls-test-tools/lib/helpers/eventBridge.js:101:25)
        at processTicksAndRejections (internal/process/task_queues.js:93:5)
        at Function.getAllEventBridgeMessages (/Users/georgesbiaux/Projects/Pyxo/pyxo/backend/tests/functions/utils/event-bridge.utils.ts:76:24)
        at Object.<anonymous> (/Users/georgesbiaux/Projects/Pyxo/pyxo/backend/tests/functions/deposit/createDepositCommand.test.ts:128:7)

When my test suite fails because an event has not been send correctly to EventBridge, it would be clearer if it was the assertion on the event that cause the failure :)

Thanks

@valentinbeggi
Copy link
Contributor

I believe this is fixed now, if there is no event the returned object contains at least ResponseMetadata with a requestId (and no Message)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants