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

Dynamic Routes like [id].tsx doesn't be update in my github action #370

Open
andrenjdev opened this issue Oct 19, 2022 · 0 comments
Open

Comments

@andrenjdev
Copy link

andrenjdev commented Oct 19, 2022

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 npm@8.5.4 -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?

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