Good day! Before I start I have searched the forum and I did read This article able how to get two apps to talk. That is how I got as far as I have! This may end up being just someone looking at my code and telling me what I’m doing wrong because I’m not seeing it.
So far, pretty simple. The Express App when pinged will call the Flask app and return what the Flask app gets from Gemini.
In the Flask app I added CORS and as you can see I added the full URL for the Express app for the “origins” attribute. I have also tried this with setting CORS authorization for any origin. In the nix file I also added the PORT and API_SERVICE urls. When starting the app I do:
and echo it out, boot the app, click the link and it opens in a new tab. This base URL is the swagger ui page and I can “Try it out!” and it all works. CURL-ing my endpoint also works. Good great!
So then when I start up the Express app I immediately get a 401 error - Not Authorized. This is not a CORS error mind you - the Flask app never actually gets pinged. Whatever built in mechanism there is for security rejects the call before it actually makes it to the route.
Inspecting the Network tab when I hit my actual endpoint I can see there is a WorkstationJwt included but that appears missing when the Express app sends its request. I thought including withCredentials: true in my request would be enough to take care of that.
Anyway - I’m at a loss now. I feel like I am really close (or at least close to replacing my 401 with a CORS error lol). Not sure what to do from here, any assistance would be appreciated.
I wanted to add this, seeing weird behavior thats probably irrelevant. One of the forums or posts mentioned to manually start the app after setting up my ENVs however when I manually stop the app when IDX boots up, then open a new terminal and do my commands, then start the app - I can’t open ANOTHER terminal.
This happens in both apps. Anyone else seeing this? Pretty weird. It opens the terminal then immediately closes it.
401: The Workstation does not exist or your currently signed in account does not have access to it. <eye3 title='/Workstations.GetWorkstation, PERMISSION_DENIED'/> APPLICATION_ERROR;google.cloud.workstations.v1beta/Workstations.GetWorkstation;Permission 'workstations.workstations.get' denied on 'projects/monospace-1/locations/us-east4/workstationClusters/workstation-cluster-10/workstationConfigs/monospace-config-web/workstations/idx-stinky-pinky-brain-1722037466462';AppErrorCode=7;StartTimeMs=1723577331303;unknown;Deadline(sec)=10.0;ResFormat=uncompressed;ServerTimeSec=0.143198083;LogBytes=256;Non-FailFast;EffSecLevel=privacy_and_integrity;ReqFormat=uncompressed;ReqID=f827cc9bf4e315c5;GlobalID=0;Server=[2002:a72:8086:0:b0:121:c326:16a4]:4002
Hey actually you know what worked was just copying and pasting the JWT token from my devtools into Thunderclient and running it. So no CORS problem at all!
But thats not a solution, I can’t manually copy the JWT token into my app every time it expires. So why isn’t the Express app creating this JWT for me?