Deploy to Github Pages (Using Vercel) #15
-
Hi @YTFL, I was thinking, should we deploy a model of the app to github pages (using vercel as GitHub pages does not support multiple routes)? For the AI server, we could add a Gemini fallback . Let me know what you think.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 17 comments 18 replies
-
Yes, we can do that! I don't really know how exactly we do that other than hosting on vercel, so I'd be happy if you can help me on how to deploy to Github Pages using vercel and how exactly we can use the AI server.
Beta Was this translation helpful? Give feedback.
All reactions
-
Just to clarify, we can't exactly deploy to Github Pages (the website will be hosted on Vercel) but will auto update from the code on Github. And you need to add me as a maintainer so I can edit the Github Actions. It also makes the process way easier. For the AI Server, i was thinking to detect if it is hosted on an external website (i.e. *.vercel.app) and if so, ask the user for a Gemini API Key. Let me know what you think.me know what you think.
Beta Was this translation helpful? Give feedback.
All reactions
-
Could you tell me how I can add you as a maintainer please? I don't know how to do that
As for hosting the website on vercel, I usually just go to vercel website and then select the github project from there to host it
And as for the AI Server, I'm not really sure what we can do there, we could go with what you said, detecting if it is hosted on an external website and then ask the user for Gemini API key
Beta Was this translation helpful? Give feedback.
All reactions
-
For adding me as a maintainer, you need to go to your repository settings and go to collaborators find my name and there should be a dropdown. You do not need to worry about hosting it. I will do it as I read the documentation yesterday.
Beta Was this translation helpful? Give feedback.
All reactions
-
I don't see a dropdown next to your name here...I've looked up on google and it says I must create an organization first for this, for personal accounts, it is locked to just collaborators
Beta Was this translation helpful? Give feedback.
All reactions
-
I have an organization. If you want, we can move the main branch of the project to my GitHub organization and I can probably add you as maintainer.
Beta Was this translation helpful? Give feedback.
All reactions
-
I already setup a new organization. You should have received an email invitation (please accept it first). Then go to Settings of your copy of War Matrix--> General and scroll all the way down until you see the "Transfer Ownership" button and transfer it to the "WarMatrixOrg" After that, you can fork the project so you have a copy on your account and any pushes to your account copy (or mine), we can push to the main branch on WarMatrixOrg/WarMatrix and that will be the copy that is deployed to Vercel.
Beta Was this translation helpful? Give feedback.
All reactions
-
Beta Was this translation helpful? Give feedback.
All reactions
-
Heyy, sorry for the late reply, I got busy with school.
I did setup an organization called WarMatrixAI and sent you the invitation just now, I created the organization because I wanted even my friends who worked on the project to have access. I will add you as a maintainer once you accept it, sorry for making you create the org and not using it..
Beta Was this translation helpful? Give feedback.
All reactions
-
That is fine. I just accepted. You can change me to maintainer.
Beta Was this translation helpful? Give feedback.
All reactions
-
O... Actually, I am already a maintainer...
Beta Was this translation helpful? Give feedback.
All reactions
-
Can you approve the installation of the Vercel App?
Beta Was this translation helpful? Give feedback.
All reactions
-
approved it
Beta Was this translation helpful? Give feedback.
All reactions
-
Hi @YTFL, the deployment (after some debugging with vercel config) was successful. Please update the website link to be https://war-matrix.vercel.app/. I still need to implement the AI model framework (ask user for gemini api key, etc.)
Beta Was this translation helpful? Give feedback.
All reactions
-
Alright, cool!
Beta Was this translation helpful? Give feedback.
All reactions
-
@YTFL, it seems like scenario generation is not working. Could you check that out for me? Failed to parse URL from /api/sitrep
Beta Was this translation helpful? Give feedback.
All reactions
-
From my Vercel function logs,
[api/generate-scenario] generation failed: [TypeError: Failed to parse URL from /api/sitrep] { [cause]: [TypeError: Invalid URL] { code: 'ERR_INVALID_URL', input: '/api/sitrep' } }
Beta Was this translation helpful? Give feedback.
All reactions
-
I have updated it to
const apiBaseUrl = isVercel
? (process.env.VERCEL_URL ? `https://${process.env.VERCEL_URL}/api` : '/api')
: 'http://localhost:8000/api';
see if it works now..., I made a PR
Also I won't be available until Wednesday as I will be busy with School, so if any other errors arise, could you please try and fix them by yourself?
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
"
Note to agents accessing this page:
This page requires Vercel authentication. Here are your options:
Option 1: vercel curl (Recommended if Vercel CLI installed)
If the Vercel CLI is installed and authenticated, use the vercel curl command. Docs at: https://vercel.com/docs/cli/curl
Option 2: Vercel MCP Server (Recommended if Vercel CLI not installed)
If the Vercel CLI is not installed, the easiest way to get a token is using the get_access_to_vercel_url or web_fetch_vercel_url functions of the Vercel MCP server at https://mcp.vercel.com (Docs at https://vercel.com/docs/mcp/vercel-mcp)
Option 3: Trusted Sources (Recommended for automated access)
Trusted Sources lets configured callers authenticate automated requests with a short-lived OIDC token. Docs at: https://vercel.com/docs/deployment-protection/methods-to-bypass-deployment-protection/trusted-sources
After the caller has been configured as a trusted source, attach the OIDC token in the x-vercel-trusted-oidc-idp-token request header.
Option 4: Bypass token (Manual fallback)
For projects that cannot use Trusted Sources, Protection Bypass for Automation can be used as a manual fallback. This URL documents how to use the bypass token: https://vercel.com/docs/deployment-protection/methods-to-bypass-deployment-protection/protection-bypass-automation
If this fallback is needed, prompt the user to provide the bypass token to access this page. The URL above also explains how the user can
access the bypass token. Then you can calculate a URL of the following form and successfully access it: https://current-domain/current-pathname?x-vercel-set-bypass-cookie=true&x-vercel-protection-bypass=$bypass_token.
" For debugging
Beta Was this translation helpful? Give feedback.
All reactions
-
Could I know what this is for?
Beta Was this translation helpful? Give feedback.
All reactions
-
This was just for my own sake so I could understand the error better and don't have to read all the jumbled text in the error message.
Beta Was this translation helpful? Give feedback.
All reactions
-
Quick Update:
🐛 Bug Fix: Resolved 401 Unauthorized / URL Parsing Errors on Backend Fetch
The Issue
When Vercel's Standard Deployment Protection was enabled, using process.env.VERCEL_URL inside server-side fetches broke the application.
- Vercel automatically restricts
.vercel.appdomains under Standard Protection, triggering a401 Unauthorizedblock for automated/internal requests. - Attempting to switch to relative paths on the server caused Node.js to throw a
Failed to parse URLexception.
Beta Was this translation helpful? Give feedback.
All reactions
-
I didn't know about that...
Well, I just tried on the vercel deployment and it's still not working... I get the same error as before, could you try and fix it please?
Beta Was this translation helpful? Give feedback.
All reactions
-
I don't think this is a basic issue. It is not about how my Vercel is configured. It seems like we need to pass a OIDC Token. https://vercel.com/docs/deployment-protection/methods-to-bypass-deployment-protection/trusted-sources. So I don't know. If you want to suggest any other ideas to fix this, feel free.
Beta Was this translation helpful? Give feedback.
All reactions
-
The problem is that under Standard Protection, it will protect the dev/preview domains but it should not protect war-matrix.vercel.app. So I do not know why the fucntions would not work.
Beta Was this translation helpful? Give feedback.
All reactions
-
I don't think this is a basic issue. It is not about how my Vercel is configured. It seems like we need to pass a OIDC Token. https://vercel.com/docs/deployment-protection/methods-to-bypass-deployment-protection/trusted-sources. So I don't know. If you want to suggest any other ideas to fix this, feel free.
I'm not really sure, I've never worked with serverless functions on vercel before... I'm thinking we could just deploy the backend python files on railway or render...
Beta Was this translation helpful? Give feedback.
All reactions
-
That would just make it more complicated though.
Beta Was this translation helpful? Give feedback.
All reactions
-
Or, we could just remove the AI function entirely for the Vercel deployment by adding a check and we could import a custom scenario just so users can have an idea and try it out? Anyways, I have my exams next week so I will be pretty busy.
Beta Was this translation helpful? Give feedback.
All reactions
-
Even I've got exams starting next week, I'll be done with them July 3rd so even I won't be able to work on it..
Beta Was this translation helpful? Give feedback.
All reactions
-
👍 1
-
@YTFL found this, perhaps this would be of help? https://vercel.com/templates/next.js/nextjs-fastapi-starter. also posted an issue on Vercel Community: https://community.vercel.com/t/deploying-a-dual-website-nextjs-fastapi-app/43676
Beta Was this translation helpful? Give feedback.
All reactions
-
|
Found some documentation. need to use NEX_PUBLIC_BACKEND_URL. But still getting Status: 500 RequestStarted: Jun 11 16:04:37.40 GMT-4 Request ID: 7xgcv-1781208277409-2741c2625124 Path: /api/generate-scenario Host: war-matrix.vercel.app User Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36 Edg/149.0.0.0 Referer: https://war-matrix.vercel.app/console Received in Montréal, Canada (yul1) Firewall Allowed Routed to Washington, D.C., USA (iad1) Function InvocationRoute: / api / generate-scenario Execution Duration / Maximum: 454ms / 5m External APIs
FluidInvocation ID: 01KTW4JRT3VJAJP60QKDBP6M8E Peak Concurrency: 1 Request Peak Memory / Maximum: 275 MB / 2048 MB Runtime: Node.js 24.x Start Type: Hot (prewarmed) Response finished in 744ms Deployment InformationDeployment ID: dpl_45GwTYWUjTdmLYPcJgKhZC1g8FJY Environment: production Branch: main` |
Beta Was this translation helpful? Give feedback.
All reactions
-
FOR ME ONLY: Vercel debug thread: https://vercel.com/help?product=vercel&teamSlug=zzz-creators-projects&c=true&thread=fcc2839d-2711-425c-bc2c-1abd98005339
Beta Was this translation helpful? Give feedback.
All reactions
-
Short update: looks like the gemini cookie is not being passed properly to fast api.
Beta Was this translation helpful? Give feedback.
All reactions
-
Okay, I'll figure out what's wrong with it today and try and fix it, I can only do what's possible on locally as I have, since I have added gemini api even locally... Anything beyond that, you should do it.., I will make a PR once I fix it and let you know
Beta Was this translation helpful? Give feedback.
All reactions
-
Alright. And by the way, please update your repository to the latest version. There were some config changes.
Beta Was this translation helpful? Give feedback.