Closed PythonMove closed 2 years ago
Sorry for the late reply, seems that the custom domain was not set correctly on the tf_next
module, since the required parameters for enable_multiple_deployments
and multiple_deployments_base_domain
are missing in your configuration.
Adding them should fix the setup:
########################################################################################################################
# Terraform Next.js Module
########################################################################################################################
module "tf_next" {
source = "milliHQ/next-js/aws"
version = "1.0.0-canary.4"
cloudfront_aliases = local.aliases
cloudfront_acm_certificate_arn = data.aws_acm_certificate.cloudfront_acm_certificate.arn
deployment_name = "redacted-deployment-name"
+ enable_multiple_deployments = true
+ multiple_deployments_base_domain = "*.redacted.domain"
providers = {
aws.global_region = aws.global_region
}
}
Hi,
Thank you for the response. Changes to the main.tf proposed by you indeed helped. Thank you very much!
With that said, I have another question If I may. The current tf_next module looks like this:
module "tf_next" {
source = "milliHQ/next-js/aws"
version = "1.0.0-canary.5"
create_image_optimization = false
enable_multiple_deployments = true
multiple_deployments_base_domain = local.acm_certificate_domain
cloudfront_aliases = local.aliases
cloudfront_acm_certificate_arn = data.aws_acm_certificate.cloudfront_acm_certificate.arn
deployment_name = "redacted-deployment-name"
providers = {
aws.global_region = aws.global_region
}
}
On the deployed website, some images are not being loaded (404 from S3). Images that were loaded, were imported in NextJS components in .css files, while files that were not loaded, were imported in .tsx files. Do you think this can be an issue in the tf-next source code, or my codebase?
If your code relies on the image component (next/image
), it is currently not supported by the v1.0.0-canary
version (only works for the previous version v0.x
).
Support for it is tracked here: #339
Thanks for the response.
Indeed, the code relies on the image component. I will look forward to the support of image components. This concludes all my questions, thank you for your support :)
Hi,
I am trying out for the first time this package (latest canary version). I am struggling to deploy a nextJS 12 application. The deployment command outputs success but the URL is clearly wrong:
When I go to the cloudfront alias URL, I get 500 with Code: PROXY_MISSING_CONFIG. I haven't found any proxy configuration documentation, and google also is not helpful, so I am in dark here. Has anyone encountered the issue so far and resolved this?
I am using tf-next installed locally in the project folder. Here are steps that I have taken:
Terraform deployment was successful. Both tf-next build and deploy commands were also successful, but as you can see above, the URL is broken.
This is my terraform configuration at main.tf: