bakerkretzmar / laravel-deploy-preview

A GitHub Action to deploy PR preview sites for Laravel apps.
MIT License
19 stars 6 forks source link

AxiosError: Request failed with status code 404 when let's encrypt fails #19

Closed GlitchWitch closed 10 months ago

GlitchWitch commented 11 months ago

When running this script a 404 error occurs during the clean up step.

Run bakerkretzmar/laravel-deploy-preview@v2
Creating new deploy preview site named 'test'
Site created!
Obtaining SSL certificate
SSL certificate obtained!
Installing 'REDACTEDORG/REDACTEDREPO' Git repository in site
Repository installed!
Updating .env file
Updated .env file!
Setting up scheduler
Scheduled job command set up!
Updating deploy script
Updated deploy script!
Enabling Quick Deploy
Quick Deploy enabled!
Deploying site
Site deployed!
Cleaning up...

file:///home/runner/work/_actions/bakerkretzmar/laravel-deploy-preview/v2/webpack:/laravel-deploy-preview/node_modules/axios/lib/core/settle.js:19
    reject(new AxiosError(
^
AxiosError: Request failed with status code 404
    at settle (file:///home/runner/work/_actions/bakerkretzmar/laravel-deploy-preview/v2/webpack:/laravel-deploy-preview/node_modules/axios/lib/core/settle.js:19:1)
    at Unzip.handleStreamEnd (file:///home/runner/work/_actions/bakerkretzmar/laravel-deploy-preview/v2/webpack:/laravel-deploy-preview/node_modules/axios/lib/adapters/http.js:572:1)
    at Unzip.emit (node:events:526:[35](https://github.com/REDACTEDORG/REDACTEDREPO/actions/runs/6598974758/job/17927500504#step:3:36))
    at endReadableNT (node:internal/streams/readable:1[37](https://github.com/REDACTEDORG/REDACTEDREPO/actions/runs/6598974758/job/17927500504#step:3:38)6:12)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)

Interestingly here, it shows SSL certificate obtained! despite that step failing due to our environment not being accessible to let's encrypt.

GlitchWitch commented 11 months ago

This seems to be caused by let's encrypt failing to obtain a certificate despite the message indicating it succeeded.

There are two ways to solve this:

  1. Implement better error handling and messages to indicate what went wrong
  2. Implement #18
bakerkretzmar commented 10 months ago

I don't think there's actually any way through the Forge API to be sure that obtaining the certificate failed, right now I'm just assuming that if it disappears that's what happened. I can try to handle that specific error more gracefully though.

bakerkretzmar commented 10 months ago

Fixed in v2.1.4 (error is handled and we output a detailed message specific to this possible failure).