0

I have a Nuxt SSR app which want to deploy on server. My CI (Buddy) runs pipeline to do it by running bash commands. All of them runs without any error but at the end application can not find files in .nuxt directory. It throws an error 404 not found _nuxt/46f6559.modern.js Everything looks ok except the file really does not exists on the server. I try it by command

sudo find .  -type f -name 46f6559.modern.js

to find it. It seems like main file link to old files which no longer exists in repository. But really dont know what is going on there. The build looks fresh and .nuxt folder is filled by build files.

This are the commands in pipeline which works fine.

yarn build

Then

if [ -d "builds/$BUDDY_EXECUTION_REVISION" ] && [ "$BUDDY_EXECUTION_REFRESH" = "true" ];
then
   echo "Removing: builds/$BUDDY_EXECUTION_REVISION"
   rm -rf builds/$BUDDY_EXECUTION_REVISION;
fi

if [ ! -d "builds/$BUDDY_EXECUTION_REVISION" ];
then
   echo "Creating: builds/$BUDDY_EXECUTION_REVISION"
   cp -dR deploy-cache builds/$BUDDY_EXECUTION_REVISION;
fi

Then

echo "Linking current to revision: $BUDDY_EXECUTION_REVISION"
rm -f current
ln -s builds/$BUDDY_EXECUTION_REVISION current

Then

pm2 startOrReload current/ecosystem.config.js --only Production

Everything ends up with success. Does anybody know what could happened there? My be the last of the commands? If I run it on local machine everything works well. Thanks for any help.

Čamo
  • 3,863
  • 13
  • 62
  • 114
  • 1
    When do you run that `find` command and also, from where do you take that `46f6559.modern.js` hash number? That one is supposed to be different each time (when you build it). If not sure what exists when, you should run a `ls` and check the files before your whole CI and after, just before it's done running. – kissu May 23 '22 at 13:42
  • I see 46f6559.modern.js in browser network log as 404. Then I tried to find it by find command in the server root folder. There is no file with this name. Basic sceleton of Nuxt app is working and then it try to load components but there are no files. It seems like some kind of cache.... – Čamo May 23 '22 at 13:47
  • 1
    If it's 404 in the network tab, it's not on the server (seems logic). Now the question is why you're loading such file from your client side code. The issue is probably from here. Messed up with the hashes during the build phase? – kissu May 23 '22 at 13:52
  • Ok I have it. The problem is in the last command `pm2 startOrReload current/ecosystem.config.js --only Production` There has to be Development instead of Production – Čamo May 23 '22 at 14:00
  • 1
    What's the difference between the two options? – kissu May 23 '22 at 14:01
  • ecosystem.config.js contains two environments. Production and Development. There are some differencies between them. – Čamo May 23 '22 at 14:11
  • 1
    Thanks for help. PS Still dont know why component does not react on Vuex store getter change. Newst problem is that Vuex does not update getter value althought is is pretty simple object nothing exclusive. – Čamo May 23 '22 at 14:22

1 Answers1

0

The issue was solved by using

pm2 startOrReload current/ecosystem.config.js --only Development

rather than

pm2 startOrReload current/ecosystem.config.js --only Production
kissu
  • 40,416
  • 14
  • 65
  • 133