question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot deploy via CI/CD - s3_static_assets_1.default is not a function

See original GitHub issue

Describe the bug

When trying to use CI/CD with github actions I get an error about s3 bucket.

Actual behavior

185s › sr-web › Deploying 
aNA
  185s › sr-web › Deploying 
aNA  DEBUG ─ Deploying bucket sr-web-test in region ***.
  DEBUG ─ Checking if bucket sr-web-test exists.

  185s › sr-web › Deploying .
aNA  DEBUG ─ Setting acceleration to "true" for bucket sr-web-test.
  DEBUG ─ Bucket sr-web-test was successfully deployed to the *** region.

  185s › sr-web › Deploying .
aNA
  185s › sr-web › Deploying ..
aNA
  error:
  TypeError: s3_static_assets_1.default is not a function
    at NextjsComponent.<anonymous> (/home/runner/.serverless/components/registry/npm/@sls-next/serverless-component@1.15.1/node_modules/@sls-next/serverless-component/dist/component.js:138:45)
    at Generator.next (<anonymous>)
    at fulfilled (/home/runner/.serverless/components/registry/npm/@sls-next/serverless-component@1.15.1/node_modules/@sls-next/serverless-component/dist/component.js:5:58)
25h
  185s › sr-web › TypeError: s3_static_assets_1.default is not a function

error Command failed with exit code 1.
25hinfo Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Process completed with exit code 1.

Expected behavior

Deployment should complete

Steps to reproduce

deploy via github actions or possibly any ci/cd

Screenshots/Code/Logs

serverless.yml

# serverless.yml

sr-web:
  component: "@sls-next/serverless-component@1.15.1"
  inputs:
    bucketName: sr-web-test
    memory: 512
    timeout: 30
    runtime: "nodejs12.x"
    useServerlessTraceTarget: true
    domain: ["web", "<DOMAIN>"] # [ sub-domain, domain ]

config.next.js

module.exports = {
  env: {
    ...
  }
}

package.json snippet

    "predeploy:test:infrastructure": "rimraf .env && node configure.js test && ./scripts/pre-test-deploy-notify.sh",
    "deploy:test:infrastructure": "sls --debug",
    "postdeploy:test:infrastructure": "node post.js test && ./scripts/test-deploy-notify.sh",

Github actions file

#github actions yaml
name: Continuous deploy Dev

on:
  push:
    branches: [dustingraves/ch33/setup-test-framework]

jobs:
  serverless-deploy:
    if: "!contains(github.event.head_commit.message, 'skip ci') && !contains(github.event.head_commit.message, 'ci skip')"
    runs-on: ubuntu-latest

    env:
      AWS_ACCESS_KEY_ID: ${{secrets.AWS_ACCESS_KEY_ID}}
      AWS_SECRET_ACCESS_KEY: ${{secrets.AWS_SECRET_ACCESS_KEY}}

    steps:
      - uses: actions/checkout@v1
      - uses: actions/setup-node@v1
        with:
          node-version: 12

      - name: Configure AWS Credentials
        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: ${{ secrets.AWS_REGION }}

      - name: Install dependencies
        run: rm -rf node_modules && yarn install --frozen-lockfile

#     TODO: fix env file to be dynamic so test build can run
#      - name: Run Build
#        run: node_modules/.bin/next build

#      TODO: Can't run tests because we need to mock things
#      - name: Run tests
#        run: yarn test

      - name: Install Serverless Framework
        run: npm install -g serverless@1.67.0

        #TODO Change 'push' to 'merge'
      - name: Deploy to AWS
        if: "github.ref == 'refs/heads/dustingraves/ch33/setup-test-framework' && github.event_name == 'push'"
        run: 'yarn deploy:test:infrastructure'

Versions

  • OS/Environment: x86_64 x86_64 x86_64 GNU/Linux
  • @sls-next/serverless-component version: @sls-next/serverless-component@1.15.1
  • Next.js version: "next": "9.4.4",

Additional context

When I upgrade to the latest serverless-component I get this issue: https://github.com/serverless-nextjs/serverless-next.js/issues/828

Checklist

  • [x ] You have reviewed the README and FAQs, which answers several common questions.
  • [x ] Please first try using the most recent latest or alpha @sls-next/serverless-component release version, which may have already fixed your issue or implemented the feature you are trying to use. Note that the old serverless-next.js component and the serverless-next.js plugin are deprecated and no longer maintained.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7

github_iconTop GitHub Comments

1reaction
Taiterbasecommented, Jan 5, 2021

I just had the same issue using AWS Linux 2.0 CodeBuild. Same package build @1.15.1.

EDIT: Upgrading to component: "@sls-next/serverless-component@1.18" solved it for me, as it did for others in #765

0reactions
dphangcommented, May 21, 2021

I think this can be closed as the latest versions should have fixed the dependency pinning issues, and I’ve also published various patches for old versions (in case you can’t upgrade yet, but it is recommended you do since there are lots of features or bug fixes since then). Feel free to open a new issue if there are other dependency related issues.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Automate static website deployment to Amazon S3
This pattern describes the steps required to add a continuous integration and continuous delivery (CI/CD) pipeline to an existing bucket in Amazon Simple ......
Read more >
Troubleshooting CI/CD - GitLab Docs
This message displays when the YAML configuration is too large or nested too deeply. YAML files with a large number of includes, and...
Read more >
Deploying to AWS - Serverless Framework
Deploy Function. This deployment method does not touch your AWS CloudFormation Stack. Instead, it simply overwrites the zip file of the current function...
Read more >
Deploy to AWS with S3 | Bitbucket Cloud - Atlassian Support
The following guide shows how to deploy your files to an AWS S3 bucket using the aws-s3-deploy pipe in Bitbucket Cloud Pipelines.
Read more >
Troubleshooting Cloud Functions - Google Cloud
User with Project Viewer or Cloud Function role cannot deploy a function ... service account is not specified, 1st gen functions default to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found