Cached build files


I’m building a new headless store with Frontity and I’m facing a weird issue; the build catalog seems to be cached in some way. I hit errors with references to undefined variables when running npx frontity serve, even though the variable doesn’t exist anymore in my package.

I’m using a setup with Bitbucket Pipelines which automatically pulls the code, runs npx frontity build and then restarts the npx frontity serve. But this shouldn’t matter since I’ve a) done this manually, outside of the pipelines and b) deleted the build-catalog between my tries. Still the same result.

It’s really weird, seems like it’s caching the build result in some other catalog and then using that to recreate npx frontity build. Am I missing out on some important variable that I need to supply to the npx frontity build to make it force a complete rebuild?

Thank you in advance.

Hi @lagerroos

Welcome to the community. Do you have a link to a repo so we can take a look at your code, and to the live site so we can see the error in action.

What error messages are you getting?

In order to provide the best possible help as quickly and as efficiently as possible, can you please provide the info suggested here?

The more info you provide about your issue the better. Providing a repo or code-sandbox with your code is especially helpful to find solutions of technical issues with specific code.

Hey @mburridge!

Thank you.

I saw the template but since the project isn’t open source I don’t want to publish the codebase to a repository. Further I don’t believe this would provide anything to the matter since the missing variable is not in the project anymore.

I’m just wondering if there’s any caching involved in the build-commando and if so, how can I coear this?

This works on my local computer using the same codebase. It’s only on the server the builds fail to serve with an error of an undefined variable, which have but doesn’t exist anymore in the project.

Hi @lagerroos

Are you asking if any remnants of a previous build might still be present when you run npx frontity build? If so then I don’t believe that to be the case but I will check.

I think we would need to know more about your hosting platform to help you further. Can you provide a screenshot of the error that you are getting.

On GitHub and BitBucket you can create private repositories so your code doesn’t need to be made public.

Hey there!

I actually solved this, hence my late reply. The problem laid in the fact that my theme is a custom npm package, which had to be installed after the new changes. Which furthermore caused cache-alike issues on build.

Thank you @mburridge for the fast replies.

1 Like

Just to add some more info related to this thread:

Here’s the documentation of Frontity build commands →

Here’s the documentation of Environment Variables that can be used with Frontity commands (“build” among others)→