From 17d184cbab0333fd0348089924cc9f35395e13b0 Mon Sep 17 00:00:00 2001 From: Saad Najmi Date: Mon, 10 Nov 2025 23:17:35 -0800 Subject: [PATCH] fix: add exception handling to hermes-utils.rb (#54411) Summary: While working on the React Native macOS upgrade, I ran into this error while fetching hermes during `pod install` ``` Fetching podspec for `hermes-engine` from `../react-native/sdks/hermes-engine/hermes-engine.podspec` [!] Failed to load 'hermes-engine' podspec: [!] Invalid `hermes-engine.podspec` file: SSL_connect returned=1 errno=0 peeraddr=52.41.8.25:443 state=error: certificate verify failed (unable to get certificate CRL). # from /Users/sanajmi/Developer/react-native-macos/packages/react-native/sdks/hermes-engine/hermes-engine.podspec:26 ``` It seemed this simply came from an exception in `nightly_tarball_url`, which would stop the process. This change adds a fallback so that `pod install` can continue. bypass-github-export-checks ## Changelog: [INTERNAL] [FIXED] - add exception handling to hermes-utils.rb Pull Request resolved: https://github.com/facebook/react-native/pull/54411 Test Plan: CI should pass Reviewed By: cipolleschi Differential Revision: D86225597 Pulled By: sbuggay fbshipit-source-id: 3988dd5fdf199b719b9946234f865b2a4de389f8 --- .../sdks/hermes-engine/hermes-utils.rb | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/packages/react-native/sdks/hermes-engine/hermes-utils.rb b/packages/react-native/sdks/hermes-engine/hermes-utils.rb index f264ec1f380..c116c93adc5 100644 --- a/packages/react-native/sdks/hermes-engine/hermes-utils.rb +++ b/packages/react-native/sdks/hermes-engine/hermes-utils.rb @@ -256,16 +256,20 @@ def nightly_tarball_url(version) xml_url = "https://central.sonatype.com/repository/maven-snapshots/#{namespace}/#{artifact_coordinate}/#{version}-SNAPSHOT/maven-metadata.xml" - response = Net::HTTP.get_response(URI(xml_url)) - if response.is_a?(Net::HTTPSuccess) - xml = REXML::Document.new(response.body) - timestamp = xml.elements['metadata/versioning/snapshot/timestamp'].text - build_number = xml.elements['metadata/versioning/snapshot/buildNumber'].text - full_version = "#{version}-#{timestamp}-#{build_number}" - final_url = "https://central.sonatype.com/repository/maven-snapshots/#{namespace}/#{artifact_coordinate}/#{version}-SNAPSHOT/#{artifact_coordinate}-#{full_version}-#{artifact_name}" + begin + response = Net::HTTP.get_response(URI(xml_url)) + if response.is_a?(Net::HTTPSuccess) + xml = REXML::Document.new(response.body) + timestamp = xml.elements['metadata/versioning/snapshot/timestamp'].text + build_number = xml.elements['metadata/versioning/snapshot/buildNumber'].text + full_version = "#{version}-#{timestamp}-#{build_number}" + final_url = "https://central.sonatype.com/repository/maven-snapshots/#{namespace}/#{artifact_coordinate}/#{version}-SNAPSHOT/#{artifact_coordinate}-#{full_version}-#{artifact_name}" - return final_url - else + return final_url + else + return "" + end + rescue => e return "" end end