Skip to content

Bug: Declared Idempotency Packages Do Not Match Repo Structure #1486

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

Closed
brianhyder opened this issue Jun 7, 2023 · 5 comments · Fixed by #1487
Closed

Bug: Declared Idempotency Packages Do Not Match Repo Structure #1486

brianhyder opened this issue Jun 7, 2023 · 5 comments · Fixed by #1487
Assignees
Labels
bug Something isn't working completed This item is complete and has been merged/shipped idempotency This item relates to the Idempotency Utility

Comments

@brianhyder
Copy link

Expected Behaviour

The package should allow requiring/importing the modules as described in the package.json for idempotency.

Current Behaviour

The packge.json describes exports for the root of the module, persistence, and the dynamodb persistence layer. However, the capitalization of the dynamodb persistence layer class is incorrect (DynamoDbPersistenceLayer => DynamoDBPersistenceLayer).

Uncaught Error Error: ENOENT: no such file or directory, open '/workspaces/api/lambda/service/node_modules/@aws-lambda-powertools/idempotency/lib/persistence/DynamoDbPersistenceLayer.js'
    at openSync (fs:601:3)
    at readFileSync (fs:469:35)
    at readFile (/workspaces/api/lambda/service/node_modules/jest-runtime/build/index.js:2574:21)
    at transformFile (/workspaces/api/lambda/service/node_modules/jest-runtime/build/index.js:1733:25)
    at _execModule (/workspaces/api/lambda/service/node_modules/jest-runtime/build/index.js:1662:34)
    at _loadModule (/workspaces/lambda/service/node_modules/jest-runtime/build/index.js:1223:12)
    at requireModule (/workspaces/api/lambda/service/node_modules/jest-runtime/build/index.js:1047:12)
    at requireModuleOrMock (/workspaces/api/lambda/service/node_modules/jest-runtime/build/index.js:1248:21)
    at eval (repl:1:53)

The package.json is also missing the now available middleware module.

Uncaught ModuleNotFoundError Error: Cannot find module '@aws-lambda-powertools/idempotency/middleware' from 'src/abc.js'
    at _throwModNotFoundError (/workspaces/api/lambda/service/node_modules/jest-resolve/build/resolver.js:491:11)
    at resolveModule (/workspaces/api/lambda/service/node_modules/jest-resolve/build/resolver.js:413:10)
    at _getVirtualMockPath (/workspaces/api/lambda/service/node_modules/jest-resolve/build/resolver.js:733:14)
    at _getAbsolutePath (/workspaces/api/lambda/service/node_modules/jest-resolve/build/resolver.js:690:14)
    at getModuleID (/workspaces/api/lambda/service/node_modules/jest-resolve/build/resolver.js:617:31)
    at _shouldMockCjs (/workspaces/api/lambda/service/node_modules/jest-runtime/build/index.js:1984:37)
    at requireModuleOrMock (/workspaces/api/lambda/service/node_modules/jest-runtime/build/index.js:1242:14)
    at eval (repl:1:53)

Code snippet

Steps to Reproduce

const idempotency = require('@aws-lambda-powertools/idempotency');
const persistence = require('@aws-lambda-powertools/idempotency/persistence');
const DynamoDBPersistenceLayer = require('@aws-lambda-powertools/idempotency/dynamodb');
const middleware = require('@aws-lambda-powertools/idempotency/middleware');

Possible Solution

Update the package.json to have the correct capitalization and add the middle ware module to the exports declaration.

Powertools for AWS Lambda (TypeScript) version

latest

AWS Lambda function runtime

18.x

Packaging format used

npm

Execution logs

No response

@brianhyder brianhyder added triage This item has not been triaged by a maintainer, please wait bug Something isn't working labels Jun 7, 2023
@dreamorosi
Copy link
Contributor

Hi @brianhyder thank you for reporting this.

I'll be adding the Middy middleware in the next couple of hours and double-check the other one. When I was doing the tests I checked on macOS & Linux OS and was initially having case-sensitive errors on that file, however I thought I fixed them. I'll check again.

@dreamorosi dreamorosi self-assigned this Jun 7, 2023
@dreamorosi dreamorosi added the idempotency This item relates to the Idempotency Utility label Jun 7, 2023
@dreamorosi dreamorosi added this to the Idempotency - Beta release milestone Jun 7, 2023
@dreamorosi dreamorosi added discussing The issue needs to be discussed, elaborated, or refined and removed triage This item has not been triaged by a maintainer, please wait labels Jun 7, 2023
@dreamorosi dreamorosi linked a pull request Jun 7, 2023 that will close this issue
9 tasks
@dreamorosi
Copy link
Contributor

I have just pushed the changes & opened the PR, both issues should be fixed and I have also added an export for the types that was not present, so you couldn't import the types in your code if you wanted to do so.

Let me know if you have any chance to test it before I merge it and confirm that it fixes the issue.

@dreamorosi dreamorosi added confirmed The scope is clear, ready for implementation and removed discussing The issue needs to be discussed, elaborated, or refined labels Jun 7, 2023
@dreamorosi dreamorosi moved this from Working on it to Pending review in AWS Lambda Powertools for TypeScript Jun 7, 2023
@brianhyder
Copy link
Author

Thank you, I should be able to test it out in the next few hours.

@github-project-automation github-project-automation bot moved this from Pending review to Coming soon in AWS Lambda Powertools for TypeScript Jun 7, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jun 7, 2023

⚠️ COMMENT VISIBILITY WARNING ⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

@github-actions github-actions bot added pending-release This item has been merged and will be released soon and removed confirmed The scope is clear, ready for implementation labels Jun 7, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jun 9, 2023

This is now released under version!

@dreamorosi dreamorosi moved this from Coming soon to Shipped in AWS Lambda Powertools for TypeScript Jun 9, 2023
@dreamorosi dreamorosi added completed This item is complete and has been merged/shipped and removed pending-release This item has been merged and will be released soon labels Jun 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working completed This item is complete and has been merged/shipped idempotency This item relates to the Idempotency Utility
Projects
None yet
2 participants