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

fix: Skip clearing undefined modules in InProcessRunner #1339

Merged

Conversation

kerueter
Copy link
Contributor

Description

This PR fixes a bug where the id property of an undefined module from the cache is accessed before deleting the module from the cache.

Motivation and Context

This problem came up while using serverless-offline in combination with serverless-plugin-offline-dynamodb-stream.
First i sent a request to a join endpoint of my API. This worked. Afterwards i sent a request to the leave endpoint of my API and the bug in the screenshot appeared.

To get rid of this bug, i added an existence check before accessing the id property of the record value in the cache object.

How Has This Been Tested?

This has been tested with and without the fix on different HTTP API routes. Without the fix, the bug in the screenshot appeared at the second call on a different route as the first call. With the fix, everything worked as expected.

Screenshots (if appropriate):

image

Copy link
Collaborator

@pgrzesik pgrzesik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @kerueter, good call 👍

@pgrzesik pgrzesik added the bug label Feb 18, 2022
@pgrzesik pgrzesik changed the title Fix: Skip clearing undefined modules in InProcessRunner fix: Skip clearing undefined modules in InProcessRunner Feb 18, 2022
@pgrzesik pgrzesik merged commit 5026e43 into dherault:master Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants