My .ruby_version says 2.7.1 and cloudflare pages edploy reads it but doesn't recognise it as built in

I’m trying to deploy a bridgetownrb static site with ruby 2.7.1 and I get a failure as the build can’t install ruby 2.7.1 (even though it should already be available).
My .ruby-version has just 2.7.1 in it and I also have the RUBY_VERSION environment variable set to 2.7.1 for good measure.

12:28:48.473	Cloning repository...
...
12:28:53.299	Success: Finished cloning repository files
12:28:54.067	Installing dependencies
12:28:54.078	Python version set to 2.7
12:28:57.265	v12.18.0 is already installed.
12:28:58.417	Now using node v12.18.0 (npm v6.14.4)
12:28:58.629	Started restoring cached build plugins
12:28:58.645	Finished restoring cached build plugins
12:28:59.408	Attempting ruby version 2.7.1
, read from .ruby-version file
12:29:02.272	e[0;33m
12:29:02.272	** WARNING **
12:29:02.272	Using custom ruby version 2.7.1
, this will slow down the build.
12:29:02.272	To ensure fast builds, set the RUBY_VERSION environment variable, or .ruby-version file, to an included ruby version.
12:29:02.273	Included versions: 2.7.1 2.6.2
12:29:02.273	e[0m
12:29:03.353	Required ruby-2.7.1
 is not installed - installing.
12:29:04.692	Searching for binary rubies, this might take some time.
12:29:05.917	No binary rubies available for: ubuntu/16.04/x86_64/ruby-2.7.1
.
12:29:05.917	Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
12:29:05.992	Checking requirements for ubuntu.
12:29:06.797	Requirements installation successful.
12:29:06.941	Installing Ruby from source to: /opt/buildhome/.rvm/rubies/ruby-2.7.1
, this may take a while depending on your cpu(s)...
12:29:06.992	ruby-2.7.1
 - #downloading ruby-2.7.1
, this may take a while depending on your connection...
12:29:07.518	curl: (3) Illegal characters found in URL
12:29:07.521	There was an error(3).
12:29:07.683	Checking fallback: https://ftp.ruby-lang.org/pub/ruby/./ruby-2.7.1
.tar.bz2
12:29:07.729	No fallback URL could be found, try increasing timeout with:
12:29:07.730	
12:29:07.730	    echo "export rvm_max_time_flag=20" >> ~/.rvmrc
12:29:07.730	
12:29:07.732	There has been an error fetching the ruby interpreter. Halting the installation.
12:29:07.785	ruby-2.7.1
 - #gemset created /opt/buildhome/.rvm/gems/ruby-2.7.1
12:29:08.268	Required ruby-2.7.1
 is not installed - installing.
12:29:09.625	Searching for binary rubies, this might take some time.
12:29:10.867	No binary rubies available for: ubuntu/16.04/x86_64/ruby-2.7.1
.
12:29:10.867	Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
12:29:10.943	Checking requirements for ubuntu.
12:29:11.743	Requirements installation successful.
12:29:11.889	Installing Ruby from source to: /opt/buildhome/.rvm/rubies/ruby-2.7.1
, this may take a while depending on your cpu(s)...
12:29:11.941	ruby-2.7.1
 - #downloading ruby-2.7.1
, this may take a while depending on your connection...
12:29:12.452	curl: (3) Illegal characters found in URL
12:29:12.454	There was an error(3).
12:29:12.612	Checking fallback: https://ftp.ruby-lang.org/pub/ruby/./ruby-2.7.1
.tar.bz2
12:29:12.656	No fallback URL could be found, try increasing timeout with:
12:29:12.656	
12:29:12.657	    echo "export rvm_max_time_flag=20" >> ~/.rvmrc
12:29:12.657	
12:29:12.658	There has been an error fetching the ruby interpreter. Halting the installation.
12:29:13.305	ruby-2.7.1
 - #importing gemsetfile /opt/buildhome/.rvm/gemsets/default.gems evaluated to empty gem list
12:29:13.692	ruby-2.7.1
 - #generating default wrappers.................
12:29:13.696	Error running 'run_gem_wrappers regenerate',
12:29:13.696	please read /opt/buildhome/.rvm/log/1662006553_ruby-2.7.1
/gemset.wrappers.default.log
12:29:13.699	Using /opt/buildhome/.rvm/gems/ruby-2.7.1
12:29:13.786	Warning! Executable 'ruby' missing, something went wrong with this ruby installation!
12:29:13.786	Warning! Executable 'gem' missing, something went wrong with this ruby installation!
12:29:13.787	Warning! Executable 'irb' missing, something went wrong with this ruby installation!
12:29:14.427	Using ruby version 2.7.1
12:29:14.468	Using bundler version 2.1.4 from Gemfile.lock
12:29:14.496	/opt/buildhome/.rvm/scripts/override_gem: line 19: gem: command not found
12:29:14.500	Error installing bundler
12:29:14.503	Failed: build command exited with code: 1
12:29:15.519	Failed: an internal error occurred

Not sure what I’m doing wrong, maybe some weird whitespace in my .ruby-version file? Nothing that rbenv or ruby in ubuntu WSL has any trouble with though.