spatie / flare-vite-plugin-sourcemap-uploader

A Vite plugin for uploading sourcemaps to Flare
https://flareapp.io
MIT License
2 stars 2 forks source link

Uploader assumes all axios erros have responses. #7

Closed DanielCoulbourne closed 7 months ago

DanielCoulbourne commented 7 months ago

Fixed by: #8

Not all axios erros have responses, but the error handling assumes that they do.

.catch((error) => {
    return reject(`${error.response.status}: ${JSON.stringify(error.response.data)}`);
});

In our case, a server was failing to upload because it did not have IPV6. The error that SHOULD have been shown was:

AxiosError: connect ENETUNREACH 2606:4700:20::681a:b3c:443 - Local (:::0)

What actually happened was.

/home/forge/node_modules/@flareapp/vite-plugin-sourcemap-uploader/dist/flareApi.js:35
                    return reject(`${error.response.status}: ${JSON.stringify(error.response.data)}`);
                                                    ^

TypeError: Cannot read properties of undefined (reading 'status')
    at /home/forge/node_modules/@flareapp/vite-plugin-sourcemap-uploader/dist/flareApi.js:35:53
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Node.js v18.19.0
error Command failed with exit code 1.