Updating search indexes (attempt: 1) – Error (time: 0.027s): fopen(assets/uploads/something.pdf): failed to open stream: No such file or directory

I’ve spent a whole day trying to debug a queue error with craft cms 3. I’m using the “document-search” plug-in to make assets searchable and while testing it discovered some errors in my queue.

Manually running these jobs one by one would complete successfully but any time the queue tried to run them; they would fail.

Finally after digging through the assets api I discovered this was a configuration error.

Notice the “File System Path”. That use of a relative path turned out to be the issue. When the queue running starts a job, it doesn’t start in the webroot (Usually the “craft/web” folder). That’s why it works just fine from the web ui and fails for the queue runner.

So what should this value have been?

“@webroot/assets/uploads/docs” instead of “./assets/uploads/docs” did the trick. This alias works for both the web ui and queue. The only silver lining for me was a reason to dive into the minutia of crafts assets.

Doing an “Annual contract, paid monthly” with Adobe Creative Suite? Read the fine print.

I needed photoshop for a short period of time and saw the option of month to month and thought this was great. Access to photoshop when I need it for $10 a month. That’s reasonable.

Should have read the fine print.

Cancellation Terms

You can cancel your subscription anytime via your Adobe Account page or by contacting Customer Support*. If you cancel within 14 days of your initial order, you’ll be fully refunded. Should you cancel after 14 days, you’ll be charged a lump sum amount of 50% of your remaining contract obligation and your service will continue until the end of that month’s billing period.

It wasn’t obvious anywhere in the check out process that this was an annual contract with a cancellation penalty. Only when I finally got around to canceling did I notice which was too late.

“error”:”unlink(/vagrant/craft/storage/runtime/mutex/*.lock): Text file busy”

Problem: You’re getting a dev environment setup for craft on your system and every update or plug-in install fails with an error message:

Status: Internal Server Error
Response: {"error":"unlink(/vagrant/craft/storage/runtime/mutex/xxxx.lock): Text file busy"}

Solution: You’re on windows. Yii has a different mutex mechanism on windows and by virtue of sharing a folder from a windows host; you’ve inherited some of the idiosyncrasies of the windows file system.

CraftCMS creator discusses this issue in a github issue: https://github.com/craftcms/cms/issues/4355

You’ll need to add this to your craft/config/app.php file.

return [
    'components' => [
        'mutex' => function() {
            $config = craft\helpers\App::mutexConfig();
            $config['isWindows'] = true;
            return Craft::createObject($config);
        },
    ],
];

This was actually an issue in Yii which Craft reported to the Yii framework.

syntax error: unexpected end of file

Problem: You’re trying to run a bash script embedded in a git repository to provision a vagrant machine and are getting an error that no one else is.

Solution: You’re using a windows host. The default on windows is for git to checkout files using Windows friendly line endings and then save them to the repository using unix line endings. Bash on linux is expecting unix line endings and errors if that expectation is not met.

You’ll need to set your settings for this project and re-checkout the files.
Open a command / “git bash” prompt in your project directory and run:

git config core.autocrlf

This should show you your current settings for this feature of git.

The options are true,input or false.

  • true: checkout as windows; check in as unix.
  • input: checkout as whatever is in git and check-in as unix.
  • false: checkout as whatever and check-in as same.

for this repository I changed my settings to

git config core.autocrlf true

then

git reset --hard

This is does fix the problem but it’s not the best solution for your project.
You should probably have a “.gitattributes” file in your root directory to set this settings explicitly instead of depending on your team to set these up on checkout every time.

*               text=auto
*.sh            text eol=lf
*.conf          text eol=lf
*.bat           text eol=crlf

This will inform git to have different defaults for these specific types in this project. Git is good at detecting binary vs text so you don’t have to go crazy listing every type in your project.

See more about .gitattributes in the book of git.

Follow your curiosity

I was listening to Guy Roz give his farewell address on the TED Radio Hour he mentioned this as one of his most impactful guests and I would have to agree. This is great advice.

… one of the things I’ve been saying a lot to people is that we keep telling people to follow their passion. And I feel like that can be an intimidating and almost cruel thing to say to people at times because first of all, if somebody has one central, powerful, burning passion, they’re probably already following it because that’s sort of the definition of passion – is that you don’t have a choice. If you don’t – which is a lot of people, have one central, burning, passion and somebody tells you to follow your passion, I think you have the right to give them the finger (laughter) because it just makes you feel worse.

And so I always say to people, forget it. Like, if you don’t have an obvious passion, forget about it. Follow your curiosity because passion is sort of a tower of flame that is not always accessible. And curiosity is something that anybody can access any day. Your curiosity may lead you to your passion or may it not. It may have been for, air quotes, nothing, in which case all you’ve done your entire life is spend your existence in pursuit of the things that made you feel curious and inspired and that should be good enough. Like, if you get to do that, that’s a wonderful way to spend your time here.