'GAE service being deployed is not routing to the correct URL prefix

I'm deploying different versions of an app I made, and it turns out that some people have really enjoyed the older (simpler) version of the app over newer features I'm rolling out.

I figured with services that this wouldn't be a problem in GAE, I'd just offer older versions of the app using different domain prefixes (e.g., summer2022.myapp.com", "winter2022.myapp.com", etc.) and allow users to use whichever version they prefer, with the acknowledgement that I won't provide updates/maintain older versions.

This went well at first - I deployed a "classic" version of the original app (classic service), and have an updated v2 out (default service), but now I'm trying to release the next version as a beta (beta service) and it's not routing properly. I've checked the DNS for beta and classic and they're set up the same way. I think I'm rolling the app.yaml and dispatch.yaml out correctly (gcloud app deploy ). Just hoping someone can see something I'm missing.

dispatch.yaml

dispatch:
  - url: "audiologysimulator.com/*"
    service: default

  - url: "classic.audiologysimulator.com/*"
    service: classic
    
  - url: "beta.audiolgysimulator.com/*"
    service: beta

app.yaml

runtime: nodejs14
env: standard
service: beta

A thought I had is that the static resources are coming from the default service, but then why would the classic routing be working but the beta isn't?

Is there some other (i.e., better) way to deploy a beta for testing (without using services or replacing the app that's currently up?) in GAE?

Appreciate any thoughts or answers in advance!



Solution 1:[1]

  1. Did you remember to actually deploy the new service i.e. your deploy command now has to be
   gcloud app deploy app.yaml <path to beta.yaml> <path to classic.yaml>
  1. Did you set the name of the new service in its app.yaml file?

  2. If you don't want to use services, you can use a different version. For example, you can deploy this 'beta' service as a 'beta' version of your default service. To do that, your deploy command will now be

gcloud app deploy app.yaml --version = beta 

Note that since this is a different version of your default service, the name is still app.yaml

Your app will now be available via beta.<project_id>.appspot.com

  1. Also, I think (haven't tested this myself) that even without a dispatch.yaml file, if a user browses to a subdomain that matches the name of your service or version (and you have mapped the custom domain), GAE will automatically serve that. See this documentation which says

If the user browses a domain that matches an application version name or service name, the application serves that version.

  1. Finally, for me, I always put the least restrictive route last (helps prevent errors for me but don't know if it's an issue in your case). This means that my dispatch.yaml file would have - url: "audiologysimulator.com/*" as the last entry

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 NoCommandLine