mirror of
https://github.com/DeBrosOfficial/network.git
synced 2026-01-30 06:53:03 +00:00
fixed nextjs problem
This commit is contained in:
parent
380b10add3
commit
039c246d47
@ -89,30 +89,37 @@ func (h *NextJSHandler) HandleUpload(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
if sseMode {
|
if sseMode {
|
||||||
// SSR mode - upload tarball to IPFS, then extract on server
|
// SSR mode - upload tarball to IPFS, then extract on server
|
||||||
addResp, err := h.ipfsClient.Add(ctx, file, header.Filename)
|
addResp, addErr := h.ipfsClient.Add(ctx, file, header.Filename)
|
||||||
if err != nil {
|
if addErr != nil {
|
||||||
h.logger.Error("Failed to upload to IPFS", zap.Error(err))
|
h.logger.Error("Failed to upload to IPFS", zap.Error(addErr))
|
||||||
http.Error(w, "Failed to upload content", http.StatusInternalServerError)
|
http.Error(w, "Failed to upload content", http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
cid = addResp.Cid
|
cid = addResp.Cid
|
||||||
deployment, err = h.deploySSR(ctx, namespace, name, subdomain, cid)
|
var deployErr error
|
||||||
|
deployment, deployErr = h.deploySSR(ctx, namespace, name, subdomain, cid)
|
||||||
|
if deployErr != nil {
|
||||||
|
h.logger.Error("Failed to deploy Next.js", zap.Error(deployErr))
|
||||||
|
http.Error(w, deployErr.Error(), http.StatusInternalServerError)
|
||||||
|
return
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// Static export mode - extract tarball first, then upload directory to IPFS
|
// Static export mode - extract tarball first, then upload directory to IPFS
|
||||||
cid, err = h.uploadStaticContent(ctx, file)
|
var uploadErr error
|
||||||
if err != nil {
|
cid, uploadErr = h.uploadStaticContent(ctx, file)
|
||||||
h.logger.Error("Failed to process static content", zap.Error(err))
|
if uploadErr != nil {
|
||||||
http.Error(w, "Failed to process content: "+err.Error(), http.StatusInternalServerError)
|
h.logger.Error("Failed to process static content", zap.Error(uploadErr))
|
||||||
|
http.Error(w, "Failed to process content: "+uploadErr.Error(), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
deployment, err = h.deployStatic(ctx, namespace, name, subdomain, cid)
|
var deployErr error
|
||||||
}
|
deployment, deployErr = h.deployStatic(ctx, namespace, name, subdomain, cid)
|
||||||
|
if deployErr != nil {
|
||||||
if err != nil {
|
h.logger.Error("Failed to deploy Next.js", zap.Error(deployErr))
|
||||||
h.logger.Error("Failed to deploy Next.js", zap.Error(err))
|
http.Error(w, deployErr.Error(), http.StatusInternalServerError)
|
||||||
http.Error(w, err.Error(), http.StatusInternalServerError)
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Create DNS records (use background context since HTTP context will be cancelled)
|
// Create DNS records (use background context since HTTP context will be cancelled)
|
||||||
go h.service.CreateDNSRecords(context.Background(), deployment)
|
go h.service.CreateDNSRecords(context.Background(), deployment)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user