'Building an Flutter iOS mobile application in AppCenter that uses Mapbox

I have followed the directions here for mapbox, and can successfully build the package locally. I have previously been able to build my app with older versions of mapbox, but this new version breaks it.

I have post-clone script below to add the .netrc file to the build computer and then run the flutter build command. It makes it to the flutter build line, and then fails on pod install. The error message doesn't indicate what URL returns 403. This is the code output from running with --verbose.

I have entered the mapbox_key into the App Center environment variables for the build and verified it is being set properly with the echo command.

Has anyone experienced this problem before and know how to fix it?

error message

                   Cloning into '/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/d20220201-5726-105j6ub'...
                    Cloning into '/var/folders/24/8k48jl6d249_n_qfxwsl6xvm0000gn/T/d20220201-5726-cc9t4i'...
                    % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                                   Dload  Upload   Total   Spent    Left  Speed
                  
     0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
     0    66    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
                  curl: (22) The requested URL returned error: 403

[  +14 ms] "flutter ios" took 426,650ms.
[   +7 ms] Error running pod install
[        ] 
           #0      throwToolExit (package:flutter_tools/src/base/common.dart:10:3)
           #1      CocoaPods._runPodInstall (package:flutter_tools/src/macos/cocoapods.dart:340:7)
           <asynchronous suspension>
           #2      CocoaPods.processPods (package:flutter_tools/src/macos/cocoapods.dart:168:7)
           <asynchronous suspension>
           #3      processPodsIfNeeded (package:flutter_tools/src/macos/cocoapod_utils.dart:44:30)
           <asynchronous suspension>
           #4      buildXcodeProject (package:flutter_tools/src/ios/mac.dart:203:3)
           <asynchronous suspension>
           #5      _BuildIOSSubCommand.runCommand (package:flutter_tools/src/commands/build_ios.dart:264:37)
           <asynchronous suspension>
           #6      FlutterCommand.run.<anonymous closure> (package:flutter_tools/src/runner/flutter_command.dart:1125:27)
           <asynchronous suspension>
           #7      AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #8      CommandRunner.runCommand (package:args/command_runner.dart:209:13)
           <asynchronous suspension>
           #9      FlutterCommandRunner.runCommand.<anonymous closure> (package:flutter_tools/src/runner/flutter_command_runner.dart:288:9)
           <asynchronous suspension>
           #10     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #11     FlutterCommandRunner.runCommand (package:flutter_tools/src/runner/flutter_command_runner.dart:236:5)
           <asynchronous suspension>
           #12     run.<anonymous closure>.<anonymous closure> (package:flutter_tools/runner.dart:62:9)
           <asynchronous suspension>
           #13     AppContext.run.<anonymous closure> (package:flutter_tools/src/base/context.dart:150:19)
           <asynchronous suspension>
           #14     main (package:flutter_tools/executable.dart:92:3)
           <asynchronous suspension>


[   +3 ms] ensureAnalyticsSent: 1ms
[   +1 ms] Running shutdown hooks
[        ] Shutdown hooks complete
[        ] exiting with code 1
##[error]The process '/bin/bash' failed with exit code 1
##[error]Bash failed with error: The process '/bin/bash' failed with exit code 1
##[section]Finishing: Post Clone Script
##[section]Starting: Xcode build (signed)

post-clone script

#!/usr/bin/env bash

set -e
set -x

cd ~
echo "machine api.mapbox.com
login mapbox
password $mapbox_key" > .netrc

chmod 0600 .netrc
cat .netrc

cd ./work/1/s/rider_app

git clone https://github.com/flutter/flutter.git -b 2.5.3 --depth 1
export PATH="$PATH:`pwd`/flutter/bin"

flutter doctor

flutter clean

echo "Installed flutter in `pwd`/flutter"

flutter build ios --verbose --release --no-codesign --no-sound-null-safety --dart-define=TRC_API_URL=$TRC_API_URL --dart-define=TRC_RIDER_GRPC_API_URL=$TRC_RIDER_GRPC_API_URL




Sources

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

Source: Stack Overflow

Solution Source