s3-deploy icon indicating copy to clipboard operation
s3-deploy copied to clipboard

Issue with folder option?

Open seadeep42 opened this issue 3 years ago • 12 comments

Hi,

I have a monorepo setup with the folder at packages/dashboard/build. But it seems to be deploying packages/dashboard for some reason since yesterday. And I haven't updated anything in the past few days

seadeep42 avatar Apr 06 '22 06:04 seadeep42

Which version are you using?

Reggionick avatar Apr 06 '22 06:04 Reggionick

Thank you for the quick response.

reggionick/s3-deploy@v3

seadeep42 avatar Apr 06 '22 06:04 seadeep42

We haven't made any change on the v3 of the action. Could you double check on your side?

Reggionick avatar Apr 07 '22 12:04 Reggionick

Same issue for me, no code changed in the action for months but randomly it's started pushing the root folder. Could be an internal Github change?

- name: Deploy
        uses: reggionick/s3-deploy@v3
        with:
          folder: ./interface/build

Screenshot 2022-04-08 at 09 50 34

callum-hyland avatar Apr 08 '22 08:04 callum-hyland

Same issue for me. no code changes pushing the root folder.

ajainvivek avatar Apr 10 '22 10:04 ajainvivek

@Reggionick Any updates on this issue?

ajainvivek avatar Apr 14 '22 02:04 ajainvivek

No, I can't work on this right now.. But any PR is welcome!

Reggionick avatar Apr 14 '22 07:04 Reggionick

This caused our prod dashboard to go down, we have migrated away from using GH actions to amplify for this reason. ~~Would recommend anyone else using this to pin the version that works.~~ Update: looks like it's not even a version issue; The code has had no changes for months, but our builds worked on 31st March, broke on 14th April. That's odd, and I'm unable to figure out what actually happened

palashkaria avatar Apr 18 '22 12:04 palashkaria

I'm not sure if this is the cause but in my case, the only change I notice is the Github job runner version change from 2.289.1 to 2.289.2. It's currently at version 2.290.1 but the issue seems to persist

Screenshot 2022-04-18 at 7 12 53 PM

seadeep42 avatar Apr 18 '22 13:04 seadeep42

Same issue here. We had to move to manual deploys for the time being.

tanmoyAtb avatar Apr 19 '22 07:04 tanmoyAtb

Hi,

For anyone else who came across this. I couldn't solve it with the action but found an alternate to fix it. Edited my action yml file to replace this with aws cli.

      - 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: Deploy dashboard to bucket
        run: aws s3 sync ./packages/dashboard/build s3://<bucket-name>/<folder-path>/

      - name: Invalidate dashboard cloudfront
        run: aws cloudfront create-invalidation --distribution-id <dist-id> --paths "/<invalidation-path>/*"

seadeep42 avatar Apr 20 '22 11:04 seadeep42

The root cause

In simplified form, this library calls npx --cwd ./ via exec.exec(command, [], { cwd }), where's npx "walks" upwards to first package.json and uses that folder as cwd instead, partially ignoring the set cwd within exec. For a reason the upstream docs mention setting cwd: s3-deploy './dist/**' --cwd './dist/' ....

See also https://github.com/npm/cli/issues/1975

Solution

don't use npx or don't hardcode npx --cwd ./.

Workaround

None I can think of, use either upstream instead or aws cli directly as in the comment above.

Akuukis avatar Dec 03 '22 11:12 Akuukis