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

Unable to load packages expressed through multiple "/" #766

Open
nabetti1720 opened this issue Jan 3, 2025 · 1 comment
Open

Unable to load packages expressed through multiple "/" #766

nabetti1720 opened this issue Jan 3, 2025 · 1 comment

Comments

@nabetti1720
Copy link
Contributor

nabetti1720 commented Jan 3, 2025

The following packages cannot be loaded:

// reproduction.js
const a = require('@aws-lambda-powertools/jmespath');
console.log(a);
% llrt reproduction.js
ReferenceError: Error resolving module '@aws-lambda-powertools/commons/typeutils' from '/Users/shinya/Workspaces/llrt-test/node_modules/@aws-lambda-powertools/jmespath/lib/cjs/TreeInterpreter.js'
  at <anonymous> (__cjs:/Users/shinya/Workspaces/llrt-test/node_modules/@aws-lambda-powertools/jmespath/lib/cjs/TreeInterpreter.js:4:21)
      at <anonymous> (__cjs:/Users/shinya/Workspaces/llrt-test/node_modules/@aws-lambda-powertools/jmespath/lib/cjs/ParsedResult.js:4:30)
      at <anonymous> (__cjs:/Users/shinya/Workspaces/llrt-test/node_modules/@aws-lambda-powertools/jmespath/lib/cjs/Parser.js:6:27)
      at <anonymous> (__cjs:/Users/shinya/Workspaces/llrt-test/node_modules/@aws-lambda-powertools/jmespath/lib/cjs/search.js:4:21)
      at <anonymous> (__cjs:/Users/shinya/Workspaces/llrt-test/node_modules/@aws-lambda-powertools/jmespath/./lib/cjs/index.js:4:19)
      at <anonymous> (/Users/shinya/Workspaces/llrt-test/reproduction.js:1:10)

% bun reproduction.js 
{
  __esModule: true,
  search: [Getter],
  JMESPathError: [Getter],
  LexerError: [Getter],
  ParseError: [Getter],
  IncompleteExpressionError: [Getter],
  ArityError: [Getter],
  VariadicArityError: [Getter],
  JMESPathTypeError: [Getter],
  EmptyExpressionError: [Getter],
  UnknownFunctionError: [Getter],
}

The cause has already been identified: this happens because the name and scope are separated by the first '/', I think they should be separated by the last '/'.

NOTE: The fix is ​​already ready, but it will take some time to create the test code. :)

@nabetti1720
Copy link
Contributor Author

There are cases where splitting at the last "/" does not work.

// reproduction.js
const a = require('@aws-lambda-powertools/idempotency');
console.log(a);
% llrt reproduction.js 
ReferenceError: Error resolving module '@aws-lambda-powertools/commons/utils/base64' from '/Users/shinya/Workspaces/llrt-test/node_modules/@aws-lambda-powertools/jmespath/lib/cjs/PowertoolsFunctions.js'
  at <anonymous> (__cjs:/Users/shinya/Workspaces/llrt-test/node_modules/@aws-lambda-powertools/jmespath/./lib/cjs/PowertoolsFunctions.js:11:18)
      at <anonymous> (__cjs:/Users/shinya/Workspaces/llrt-test/node_modules/@aws-lambda-powertools/idempotency/lib/cjs/IdempotencyConfig.js:4:21)
      at <anonymous> (__cjs:/Users/shinya/Workspaces/llrt-test/node_modules/@aws-lambda-powertools/idempotency/./lib/cjs/index.js:14:30)
      at <anonymous> (/Users/shinya/Workspaces/llrt-test/reproduction.js:1:10)

@nabetti1720 nabetti1720 changed the title Unable to load packages expressed through multiple paths Unable to load packages expressed through multiple "/" Jan 6, 2025
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

1 participant