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

terraform Apply is failed with basePath #288

Open
sumantapakira opened this issue Mar 21, 2022 · 3 comments
Open

terraform Apply is failed with basePath #288

sumantapakira opened this issue Mar 21, 2022 · 3 comments
Labels
feature/next.js Missing feature from Next.js

Comments

@sumantapakira
Copy link

sumantapakira commented Mar 21, 2022

I have added basePath in next.config.js as "/my-app".
And after when I deploy the app then getting this error-

[31m│[0m [0m [31m│[0m [0m[0m with module.tf_next.aws_iam_role.lambda["my-app/__NEXT_PAGE_LAMBDA_0"], [31m│[0m [0m on ../original_source/iam.tf line 20, in resource "aws_iam_role" "lambda": [31m│[0m [0m 20: name = [4m"${var.deployment_name}_${each.key}"[0m[0m [31m│[0m [0m [31m[0m[0m [31m[0m[0m [31m│[0m [0m[1m[31mError: [0m[0m[1m"function_name" doesn't comply with restrictions ("^(arn:[\\w-]+:lambda:)?([a-z]{2}-(?:[a-z]+-){1,2}\\d{1}:)?(\\d{12}:)?(function:)?([a-zA-Z0-9-_]+)(:(\\$LATEST|[a-zA-Z0-9-_]+))?$"): "my-deployment-name_my-app/__NEXT_PAGE_LAMBDA_0"[0m [31m│[0m [0m [31m│[0m [0m[0m with module.tf_next.aws_lambda_permission.current_version_triggers["my-app/__NEXT_PAGE_LAMBDA_0"], [31m│[0m [0m on ../original_source/main.tf line 96, in resource "aws_lambda_permission" "current_version_triggers": [31m│[0m [0m 96: function_name = [4m"${var.deployment_name}_${each.key}"[0m�[0m

It works fine without basePath. I think the problem is with the forward-slash which is appended after my-app. Do you have any suggestions?

@ofhouse
Copy link
Member

ofhouse commented Mar 31, 2022

Yes, seems like the basePath setting creates invalid function names since it prefixes the basePath.
Need to take a look how this could be solved.

@ofhouse ofhouse added bug Something isn't working feature/next.js Missing feature from Next.js and removed bug Something isn't working labels Mar 31, 2022
@sumantapakira
Copy link
Author

I am thinking to use replace function in Terraform which will replace the forward slash with an underscore. I will create a PR if this works.

@tazapply
Copy link

tazapply commented Jul 8, 2022

We are seeing this issue as well. @sumantapakira did you end up making a PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/next.js Missing feature from Next.js
Projects
None yet
Development

No branches or pull requests

3 participants