Function not updating
I deployed a static site to Pages and am now trying to use Functions to authenticate Decap CMS with Gitlab OAuth.
I placed the OAuth handling functions in
functions/auth
. After deploying them the first time there were some things that needed fixing, but it seems like only the first version of the functions is now used, although every new build log states:
As far as I can tell a wrangler file is not mandatory, so I haven't added one.
This is my first time using Cloudflare and Pages, so I'm probably missing something, but so far I haven't managed to figure out what it is.
Any clues how I could fix this?3 Replies
Pages keeps old versions of your deployments under different subdomains; e.g.
123aa678.myproject.pages.dev
. If you upload a new version, your old version is still available under that domain, and your new version has e.g. 234bb789.myproject.pages.dev
. Did you check, that you are either using the updated url, or the root url myproject.pages.dev
?Thanks for answering. I am definitely using the root URL without the version subdomains.
It seems like this was just a misunderstanding on my side. I was confusing a request made by Decap with my function since they were doing basically the same thing. After I changed the function the request was still being made by Decap while I was expecting it to be made by my function...
As a side note for anyone running into this, it turns out that with Gitlab you can avoid functions entirely as it supports client-only authentication through PKCE.
https://docs.gitlab.com/api/oauth2/#authorization-code-with-proof-key-for-code-exchange-pkce
https://decapcms.org/docs/gitlab-backend/
GitLab | Decap CMS | Open-Source Content Management System
Open source content management for your Git workflow
OAuth 2.0 identity provider API | GitLab Docs
Third-party authorization to GitLab.