terraform-aws-next-js
terraform-aws-next-js copied to clipboard
Dynamic Routes like [id].tsx doesn't be update in my github action
Hi Everyone,
I'm configuring a github action to update our frontend. This is github action's code:
name: Staging CI
on:
push:
branches:
- 'staging'
env:
S3_BUCKET_URI: 's3://###'
NEXT_PUBLIC_BASE_URL: "###"
CDN_DISTRIBUTION_ID: "####"
jobs:
build:
#if: github.event_name == 'pull_request_review' && github.event.review.state == 'approved' && github.event.pull_request.base.ref == 'staging'
name: Deploy Website
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v1
with:
node-version: 16
- run: npm install -g yarn
- run: npm install [email protected] -g
- run: npm i --save-dev tf-next
- run: yarn tf-next build
- uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1
- run: aws s3 sync .next-tf/ ${{ env.S3_BUCKET_URI }}
It works well, but it breaks each route with a dynamic parameter like this: [id].tsx.
I'm using this version:
source = "milliHQ/next-js/aws"
version = "0.13.2"
EDIT: I found this: Dynamic routes Dynamic routes in Next.js need a server to render the corresponding HTML. That includes pages that are dynamically rendered (e.g. with data from a database) or use a dynamic parameter in their path (example.com/blog/[postId]) where the final paths could not be calculated at build time.
So I think I have to update lambda manually?
If I update with the command terraform apply everything works well but with github action it can't find some files on the dynamic routes. How can I fix it?