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

[bug]: Can't add url config for lambda in local stack using aws-sdk #70

Closed
spelexander opened this issue Dec 22, 2022 · 0 comments
Closed

Comments

@spelexander
Copy link

Hi! first off thanks for a useful library for emulating AWS resources locally.

The issue I'm encountering is using the nodejs aws-sdk to create resources in localstack.

If I create a lambda, and then try to create/list/get a URL config for the lambda I get the following error which provides nothing to go off of for investigation:

Error [UnknownError]
    at Object.extractError (/Users/aspence/src/canvas/node_modules/aws-sdk/lib/protocol/json.js:52:27)
    at Request.extractError (/Users/aspence/src/canvas/node_modules/aws-sdk/lib/protocol/rest_json.js:61:8)
    at Request.callListeners (/Users/aspence/src/canvas/node_modules/aws-sdk/lib/sequential_executor.js:106:20)
    at Request.emit (/Users/aspence/src/canvas/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
    at Request.emit (/Users/aspence/src/canvas/node_modules/aws-sdk/lib/request.js:686:14)
    at Request.transition (/Users/aspence/src/canvas/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/Users/aspence/src/canvas/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /Users/aspence/src/canvas/node_modules/aws-sdk/lib/state_machine.js:26:10
    at Request.<anonymous> (/Users/aspence/src/canvas/node_modules/aws-sdk/lib/request.js:38:9)
    at Request.<anonymous> (/Users/aspence/src/canvas/node_modules/aws-sdk/lib/request.js:688:12)
    at Request.callListeners (/Users/aspence/src/canvas/node_modules/aws-sdk/lib/sequential_executor.js:116:18)
    at Request.emit (/Users/aspence/src/canvas/node_modules/aws-sdk/lib/sequential_executor.js:78:10)
    at Request.emit (/Users/aspence/src/canvas/node_modules/aws-sdk/lib/request.js:686:14)
    at Request.transition (/Users/aspence/src/canvas/node_modules/aws-sdk/lib/request.js:22:10)
    at AcceptorStateMachine.runTo (/Users/aspence/src/canvas/node_modules/aws-sdk/lib/state_machine.js:14:12)
    at /Users/aspence/src/canvas/node_modules/aws-sdk/lib/state_machine.js:26:10 {
  code: 'UnknownError',
  statusCode: 404,
  time: 2022-12-22T01:19:24.624Z,
  requestId: undefined,
  retryable: false,
  retryDelay: 48.11161846934877
}
create-resources started 907

See an reproducible example below, assuming 'test-lambda' has already been created:

import { Lambda } from 'aws-sdk';

import { buildWorker, packageWorker } from './workers';

const lambda = new Lambda({
  region: 'us-east-1',
  endpoint: 'http://localhost:4566',
});

const name = 'test-lambda';

it('Test create resources', async () => {
  lambda.addPermission({
    FunctionName: name,
    Action: 'lambda:InvokeFunctionUrl',
    Principal: '*',
    FunctionUrlAuthType: 'NONE',
    StatementId: '/',
  });

  try {
    // THIS FAILS
    // So does the list, or get commands
    const result = await lambda
      .createFunctionUrlConfig({
        FunctionName: name,
        AuthType: 'NONE',
      })
      .promise();
    console.log('result: ', result);
  } catch (e) {
    console.error(e);
  }
});
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