Oryx icon indicating copy to clipboard operation
Oryx copied to clipboard

failed to deploy next.js to azure app service

Open XYjourney opened this issue 3 years ago • 5 comments

Bug Report

I got this error when i deploy next.js to web app service secondly after the first successful deployment. It sayed had no permission when rename a file. 下午5:26:18 officeplusweb1: rsync: rename "/home/site/wwwroot/.next/.trace.qMaBhd" -> ".next/trace": Permission denied (13) 下午5:26:18 officeplusweb1: rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1196) [sender=3.1.2]

image

XYjourney avatar Dec 30 '21 10:12 XYjourney

any body help ?

XYjourney avatar Dec 31 '21 06:12 XYjourney

This is likely a file locking problem. Your app might be locking files inside the .next/trace folder, which is also part of your deployment - so the running app and the deployment process are both trying to write to that file.

You can try using deployment slots, temporarily stop your app during deployment, or - the ideal option - not use the web app file system to store state and rely on storage resource to do it.

gpcastro avatar Jan 03 '22 18:01 gpcastro

As @gpcastro says you should stop your application (Azure Service) because that trace folder is used by the previous development slot so azure should be able to edit this folder, once your deployment is successful you only need to start again

BarreraSlzr avatar Jan 18 '22 09:01 BarreraSlzr

@XYjourney Is it still an issue or it's resolved? Please close it if it's resolved. thanks!

qianz2 avatar Jan 20 '22 00:01 qianz2

@XYjourney did you ever resolve this because I'm getting exactly the same!

I'm deploying to a Linux slot which I stop before doing a zip deploy. I've re-created the slot, deployed successfully but the subsequent deployment fails with exactly the same error here.

My suspicion is that I have a custom bash startup script (which eventually runs 'yarn dev') - removing this and trying again doesn't help but I suspect the damage has already been done.

I'm wondering if stopping the service is not successfully killing the running (Next) node app so it's leaving .next/trace in use. I've tried using Kudu console's bash to diagnose the issue.

The file .next/trace does exist but the kudu_ssh_user isn't able to access it (cat or rm).

-rwxrwxrwx 1 nobody nogroup 14934 Oct 8 18:33 trace

ps -ax doesn't show anything obvious (was hoping for a node or yarn to be running that I could kill).

I can't find which process is keeping it open -- perhaps someone can point me in the right direction.

Any help would be very appreciated because this is making it impossible to deploy twice.

AndyRace avatar Oct 08 '22 20:10 AndyRace

I am getting this same issue with rsync. I see the recommendation to stop your app from locking the file being written to. I don't understand how is it even a real solution - isn't it equivalent to a forced outage on your service. Does someone have a more reasonable solution without stopping the service. The other solution regarding using a storage service - I guess will have to try the SDK to see if we can directly move the logs to the storage service.

sbdev001 avatar Dec 17 '23 20:12 sbdev001

If it is of help to other folks - our file that was giving the error was in .gitignore. The file was being generated during the build phase while running the tests. So, we just added a step to delete the file after running the tests. That made the error go away.

sbdev001 avatar Dec 17 '23 21:12 sbdev001

Closing this issue since it seems resolved. If this should become relevant again please open an issue in https://github.com/projectkudu/kudu as this is the component that ultimately is responsible for packaging and deployment for App Service and Functions. Oryx is purely responsible for building.

simonjj avatar Jan 11 '24 16:01 simonjj