Skip to content

Fix: Ignore missing folders during removeDir to prevent deployment failures #504

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ghaithatfeh
Copy link

@ghaithatfeh ghaithatfeh commented Apr 25, 2025

Problem

When deploying, if a directory intended for deletion (like old _next/static/* folders in static Next.js builds) no longer exists, the action throws an unhandled FTP error (550 "No such file or directory") and fails the entire deployment.

This is common in real-world static site workflows where build artifacts change frequently between deployments.

Related to issues #483, #490, #496, #493, #43, and more.


Solution

  • Wrapped removeDir() logic in a try/catch block.
  • If a 550 error (or a "no such file" type error) is encountered, it now logs a warning and safely skips the missing directory instead of throwing.
  • Other unrelated FTP errors are still rethrown normally.

This ensures smoother, more resilient deployments — without risking broken builds — especially when incremental FTP syncing is used.


Benefits

  • No more failed deployments due to missing folders.
  • Makes the action more robust for Next.js static sites, Hugo, Jekyll, and other SSG workflows.
  • Maintains clean error handling: real FTP errors still correctly fail the build.

Notes

  • Tested successfully with GitHub Actions and live FTP deployments.
  • No impact on users who don't have missing directories.
  • Does not change any public APIs or configuration options.

Thank you for maintaining this great action! 🚀
I’d love to contribute more if needed.

@konnng-dev
Copy link

@SamKirkland Could we move forward with merging this PR, or is there something holding it up?

I’m frequently running into errors about missing directories, and this update would really help my workflow.

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

Successfully merging this pull request may close these issues.

2 participants