Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Cloud Run Function redeploy failed

Hello everyone,
I created a new function in the GCP Cloud Function UI with a .NET 8.0 runtime environment. After creation, I reviewed the default sample code. Without making any modifications to the sample code, I clicked "Save and redeploy". The build subsequently failed, and the error log is as follows:

default sample codedefault sample code

 

Running "dotnet restore --packages /layers/google.dotnet.publish/packages ./HelloHttp.csproj (DOTNET_CLI_TELEMETRY_OPTOUT=true)"
Welcome to .NET 8.0!
---------------------
SDK Version: 8.0.410
----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate, view the instructions: https://aka.ms/dotnet-https-linux
----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
  Determining projects to restore...
  Restored /workspace/HelloHttp.csproj (in 5.37 sec).
Done "dotnet restore --packages /layers/google.dotnet.publish/pack..." (7.044184858s)
--------------------------------------------------------------------------------
Running "dotnet publish -nologo --verbosity minimal --configuration Release --output /layers/google.dotnet.publish/publish/bin --no-restore --packages /layers/google.dotnet.publish/packages ./HelloHttp.csproj (DOTNET_CLI_TELEMETRY_OPTOUT=true)"
  HelloHttp -> /workspace/bin/Release/net8.0/HelloHttp.dll
  HelloHttp -> /layers/google.dotnet.publish/publish/bin/
Done "dotnet publish -nologo --verbosity minimal --configuration R..." (4.864082044s)
Determined runtime version from GOOGLE_ASP_NET_CORE_VERSION: 8.x.x
WARNING: Deleted folder: /workspace/bin
Determining entrypoint from output directory /layers/google.dotnet.publish/publish/bin and project file ./HelloHttp.csproj
=== .NET - Runtime (google.dotnet.runtime@0.9.1) ===
Determined runtime version from GOOGLE_ASP_NET_CORE_VERSION: 8.x.x
--------------------------------------------------------------------------------
failed to build: building the runtime layer: (error ID: 3d9223eb):
invalid  version specified: Invalid Semantic Version. You may need to use a different builder. Please check if the language version specified is supported by the os: ubuntu2204. You can refer to https://cloud.google.com/docs/buildpacks/builders for a list of compatible runtime languages per builder
--------------------------------------------------------------------------------
Sorry your project couldn't be built.
Our documentation explains ways to configure Buildpacks to better recognise your project:
 -> https://cloud.google.com/docs/buildpacks/overview
If you think you've found an issue, please report it:
 -> https://github.com/GoogleCloudPlatform/buildpacks/issues/new
--------------------------------------------------------------------------------
ERROR: failed to build: exit status 1
Finished Step #2 - "build"
ERROR
ERROR: build step 2 "asia-east1-docker.pkg.dev/serverless-runtimes/google-22-full/builder/dotnet:dotnet_20250623_RC00" failed: step exited with non-zero status: 51

 

This issue does not occur when the runtime environment is set to Node.js 22. Currently, I've experienced this problem with .NET 8 and Java 21 runtime environments. Help?

Solved Solved
2 2 135
1 ACCEPTED SOLUTION

Hello everyone, after a day, I can now successfully write code and deploy using the inline editor. It seems there might have been an upgrade or adjustment on the Cloud Run Functions side that wasn't immediately reflected in the .NET 8 environment. In any case, everything is working fine now!

View solution in original post

2 REPLIES 2

@Meco, i got the same issue. Not sure why that is happend. even google doc says .NET 8 version works fine in those builders. But what i did, build locally and push it to artifact and then deploy in cloud run in the end its the same even if we write the code in cloud function inline. however, its best to setup code in repository and build it in cloudbuild or similar tool and push it to use for deploying cloud run. 
Good Luck 

Hello everyone, after a day, I can now successfully write code and deploy using the inline editor. It seems there might have been an upgrade or adjustment on the Cloud Run Functions side that wasn't immediately reflected in the .NET 8 environment. In any case, everything is working fine now!

Top Solution Authors