Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Deploy to Github Pages (Using Vercel) #15

zzz-creator started this conversation in Ideas
Discussion options

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.

You must be logged in to vote

Replies: 17 comments 18 replies

Comment options

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.

You must be logged in to vote
0 replies
Comment options

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.

You must be logged in to vote
1 reply
Comment options

YTFL Jun 2, 2026
Maintainer

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

Comment options

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.

You must be logged in to vote
1 reply
Comment options

YTFL Jun 2, 2026
Maintainer

image

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

Comment options

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.

You must be logged in to vote
0 replies
Comment options

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.

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
Comment options

YTFL Jun 6, 2026
Maintainer

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..

Comment options

zzz-creator Jun 6, 2026
Maintainer Author

That is fine. I just accepted. You can change me to maintainer.

Comment options

zzz-creator Jun 6, 2026
Maintainer Author

O... Actually, I am already a maintainer...

Comment options

zzz-creator Jun 6, 2026
Maintainer Author

Can you approve the installation of the Vercel App?

Comment options

YTFL Jun 6, 2026
Maintainer

approved it

Comment options

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.)

You must be logged in to vote
1 reply
Comment options

YTFL Jun 7, 2026
Maintainer

Alright, cool!

Comment options

@YTFL, it seems like scenario generation is not working. Could you check that out for me? Failed to parse URL from /api/sitrep

You must be logged in to vote
0 replies
Comment options

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' } }

You must be logged in to vote
0 replies
Comment options

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?

You must be logged in to vote
0 replies
Comment options

"

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

You must be logged in to vote
2 replies
Comment options

YTFL Jun 11, 2026
Maintainer

Could I know what this is for?

Comment options

zzz-creator Jun 11, 2026
Maintainer Author

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.

Comment options

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.

  1. Vercel automatically restricts .vercel.app domains under Standard Protection, triggering a 401 Unauthorized block for automated/internal requests.
  2. Attempting to switch to relative paths on the server caused Node.js to throw a Failed to parse URL exception.
You must be logged in to vote
5 replies
Comment options

YTFL Jun 11, 2026
Maintainer

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?

Comment options

zzz-creator Jun 11, 2026
Maintainer Author

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.

Comment options

zzz-creator Jun 11, 2026
Maintainer Author

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.

Comment options

YTFL Jun 11, 2026
Maintainer

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...

Comment options

zzz-creator Jun 11, 2026
Maintainer Author

That would just make it more complicated though.

Comment options

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.

You must be logged in to vote
1 reply
Comment options

YTFL Jun 12, 2026
Maintainer

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..

Comment options

You must be logged in to vote
0 replies
Comment options

Found some documentation. need to use NEX_PUBLIC_BACKEND_URL. But still getting
`# POST /api/generate-scenario

Status: 500

Request

Started: 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 Invocation

Route: / api / generate-scenario

Execution Duration / Maximum: 454ms / 5m

External APIs

Method Request
POST Button: _/backend/api/sitrep

Fluid

Invocation 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 Information

Deployment ID: dpl_45GwTYWUjTdmLYPcJgKhZC1g8FJY

Environment: production

Branch: main`

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

Short update: looks like the gemini cookie is not being passed properly to fast api.

You must be logged in to vote
2 replies
Comment options

YTFL Jun 12, 2026
Maintainer

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

Comment options

zzz-creator Jun 12, 2026
Maintainer Author

Alright. And by the way, please update your repository to the latest version. There were some config changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
enhancement New feature or request
2 participants

AltStyle によって変換されたページ (->オリジナル) /