Closed ransome1 closed 1 year ago
The problem seems to be, that gitHubPublisher.ts tries to read the mime type of the file, which has been build before, but cannot access it, or at least for some reason it is not defined.
Line 190: "Content-Type": mime.getType(fileName) || "application/octet-stream",
The issue happens in this function in the electron-builder module:
private doUploadFile(
attemptNumber: number,
parsedUrl: UrlWithStringQuery,
fileName: string,
dataLength: number,
requestProcessor: (request: ClientRequest, reject: (error: Error) => void) => void,
release: any
): Promise<any> {
return httpExecutor
.doApiRequest(
configureRequestOptions(
{
hostname: parsedUrl.hostname,
path: parsedUrl.path,
method: "POST",
headers: {
accept: "application/vnd.github.v3+json",
"Content-Type": mime.getType(fileName) || "application/octet-stream",
"Content-Length": dataLength,
},
},
this.token
),
this.context.cancellationToken,
requestProcessor
)
.catch(e => {
if (e.statusCode === 422 && e.description != null && e.description.errors != null && e.description.errors[0].code === "already_exists") {
return this.overwriteArtifact(fileName, release).then(() => this.doUploadFile(attemptNumber, parsedUrl, fileName, dataLength, requestProcessor, release))
}
if (attemptNumber > 3) {
return Promise.reject(e)
} else {
return new Promise((resolve, reject) => {
const newAttemptNumber = attemptNumber + 1
setTimeout(() => {
this.doUploadFile(newAttemptNumber, parsedUrl, fileName, dataLength, requestProcessor, release).then(resolve).catch(reject)
}, newAttemptNumber * 2000)
})
}
})
}
To whom it may concern, the issue is also discussed on electron builder directly: https://github.com/electron-userland/electron-builder/issues/5861
Hi @samuelmeuli ,
just since recently I'm running in issues with this action. The building is running through well, but as soon as the publishing to a tag starts, the process stops and runs into a
TypeError: Cannot read property 'getType' of undefined
which is part of electron-publish, which again is part of electron-builder. I'm using22.10.5
. Have you even stumbled accross this TypeError and can point me into the right direction how to solve it?In case it matters, here is my package.json (https://github.com/ransome1/sleek/blob/develop/package.json) and here the full build log (https://github.com/ransome1/sleek/runs/2506836432?check_suite_focus=true)
I would really appreciate any help, as I can't publish my builds right now :(