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

Impossible to use pre-existing role for ApiGatewayV1 routes #987

Open
antoine-js opened this issue Sep 4, 2024 · 3 comments · May be fixed by #1013
Open

Impossible to use pre-existing role for ApiGatewayV1 routes #987

antoine-js opened this issue Sep 4, 2024 · 3 comments · May be fixed by #1013
Assignees

Comments

@antoine-js
Copy link
Contributor

For ApiGatewayV2, it works:

const api = new sst.aws.ApiGatewayV2("MyApi");

api.route("GET /", {
  handler: "index.test",
  role: `arn:aws:iam::${accountId}:role/my-role`,
  memory: "256 MB",
  timeout: "30 seconds",
});

For ApiGatewayV1, it does not work:

const api = new sst.aws.ApiGatewayV1("MyApi");

api.route("GET /", {
  handler: "index.test",
  role: `arn:aws:iam::${accountId}:role/my-role`,
  memory: "256 MB",
  timeout: "30 seconds",
});

Error:

✕  Failed
   Error: "nodes.role" is not available when a pre-existing role is used.

       at Object.get role [as role] (file:///my-project/.sst/platform/src/components/aws/function.ts:1596
:17)
       at /my-project/.sst/platform/node_modules/@pulumi/output.ts:758:57

       at Array.some (<anonymous>)

       at impl (/my-project/.sst/platform/node_modules/@pulumi/output.ts:758:37)

       at containsUnknowns (/my-project/.sst/platform/node_modules/@pulumi/output.ts:743:12)

       at /my-project/.sst/platform/node_modules/@pulumi/output.ts:180:84

       at processTicksAndRejections (node:internal/process/task_queues:95:5)

       at async Promise.all (index 2)
@antoine-js antoine-js linked a pull request Sep 8, 2024 that will close this issue
@jonathanPretre
Copy link

Actually, we are facing the same issue in my company. It is the last blocker we have before to move all our stack to SST. I hope this issue will find a solution 🤞

@fwang
Copy link
Contributor

fwang commented Sep 21, 2024

@antoine-js sorry about the delay.

i'm not getting the error w/ ur above code:

const api = new sst.aws.ApiGatewayV1("MyApi");

api.route("GET /", {
  handler: "index.test",
  role: `arn-of-a-role-used-by-another-lambda`,
});

I could successfully deploy.

Are you manually calling .nodes.role? /cc @jonathanPretre

@antoine-js
Copy link
Contributor Author

Hi @fwang,

I retried with my current version of SST (3.0.73) and still didnt work. But I tried upgrading to latest version (3.1.35) and it worked!

So I guess it was fixed indirectly.

I still wonder if my PR is worth checking as it should prevent any potential issue like this in the future by referencing the role used when not creating one. But other than that, we can close this issue.

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

Successfully merging a pull request may close this issue.

3 participants