Google Workspace add-on returns HTTP/1.1 404 Not Found, "Cannot POST /"

48 views Asked by At

I've followed this Create a Google Workspace Add-on quickstart, which worked fine - I could see the add-on returning the card displaying a cat image.

Then per the "Note" at the top of that page, I wanted to replace the Cloud Function with a Cloud Run function. So I followed the Deploy a Node.js service to Cloud Run tutorial and got a Cloud Run deployment that returns the same card JSON.

But after replacing the runFunction URL in deployment.json with the URL above and redeploying the add-on (gcloud workspace-add-ons deployments replace quickstart --deployment-file=deployment.json), when I open the add-on from the sidebar, I get this error:

Error with the add-on.
Run time error.
HTTP error response: HTTP/1.1 404 Not Found
Response body: <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Error</title>
</head>
<body>
<pre>Cannot POST /</pre>
</body>
</html>

I tried uninstalling and reinstalling, gcloud workspace-add-ons deployments delete quickstart and deploying again, but still get the same error.

I see the correct deployment.json in the Google Workspace Marketplace SDK under Alternate runtimes -> Deployments -> quickstart.

enter image description here

1

There are 1 answers

0
Dan Dascalescu On

The Deploy a Node.js service to Cloud Run tutorial sets up a GET handler. Requests sent to Google Workspace add-ons use the POST method.

Changing app.get to app.post resolved the issue.