Skip to content

Invalidate cache in production env when serving files from GitHub source #2260

@ManasMadrecha

Description

@ManasMadrecha

Environment

.

Reproduction

I'm using a private GitHub repo as my source for Content module.

The app is a server app, i.e., Nitro app deployed on on Firebase Cloud Functions.

I have created a file server/api/abc.ts wherein it fetches from serverQueryContent. It serves the docs so fetched. It also has a simple Firebase authentication check, i.e., if the request header has a Authorization Bearer token, then serve the docs with x query, else serve with y query.

In frontend vue page, I am using this api to fetch, i.e.,

## /pages/index.vue

const {data} = await useFetch('api/abc')

Describe the bug

When I update the contents on my GitHub repo, the deployed production app should serve the updated version, i.e., it should automatically fetch the newer version of GitHub repo.

However, even on refreshing the page, it serves from the cached version of the repo files as on the time of running npm run build. I waited for 10 minutes, as it is the default TTL in unstorage module, but to no avail.

Note: the authentication guard is working on the server api, i.e., the page shows x query if someone is logged in and as soon as the person logs out, y query is automatically shown. So the api is updating itself. But the api is not fetching the newer GitHub repo, but I think it is fetching from the cache.<integritynumber].json file even in production env.

Additional context

No response

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions