Persistent PlatformIO Library Installation Warning (darwin_arm64) & Firebase Connection Failure on ESP32

Problem Description: I am working on an ESP32 project using PlatformIO in VS Code on an Apple Silicon (M-series) Mac. My goal is to send data from the ESP32 to Firebase Realtime Database using the Firebase-ESP-Client library.

I am consistently encountering two main issues:

  1. PlatformIO Build Warning: Warning! Could not find the package with 'Firebase-ESP-Client @ ^3.10.0' requirements for your system 'darwin_arm64' (this occurs for various versions of the library, including the latest).
  2. Serial Monitor Error: Despite my code seemingly having correct Firebase credentials, the ESP32 always prints: Failed to send data to Firebase: missing required credentials e.g., database URL, host and tokens.
  3. CRITICAL BLOCKER: Even with #define FIREBASE_DEBUG enabled as the very first line in src/main.cpp, no debug output whatsoever from the Firebase library appears in the serial monitor. Only the “Failed to send data…” error.

Hardware & Software Environment:

  • Operating System: macOS (Apple Silicon / darwin_arm64)
  • IDE: Visual Studio Code
  • Board: ESP32 Dev Module
  • Firebase Library: Firebase-ESP-Client (attempted with latest via lib_deps, @^3.10.0 via lib_deps, and manual GitHub master branch download).

Firebase Project Configuration:

  • Firebase Host (Database URL): https://smart-mail-box-bba77-default-mbstjnb.firebaseio.com (Confirmed correct from console).

  • Firebase Web API Key: AIzaSyA4mybsdnksnkp2Q00gfioRvZzy2hC200J4 (Confirmed exact match from Firebase console’s firebaseConfig snippet).

  • Realtime Database Security Rules:

  • {
    “rules”: {
    “.read”: "now < true
    “.write”: "now < true
    }
    }

  • Authentication Method: Anonymous (firebaseAuth.user.email = ""; firebaseAuth.user.password = "";).

Troubleshooting Steps Taken (and Results):

  1. Verified Wi-Fi Credentials: Confirmed WIFI_SSID and WIFI_PASSWORD are correct. ESP32 successfully connects to Wi-Fi.
  2. Verified Firebase Credentials in Code: Triple-checked FIREBASE_HOST and FIREBASE_AUTH against Firebase Console, confirming exact matches.
  3. Confirmed RTDB Rules & Expiration: Rules are open for public read/write and are currently valid.
  4. Updated Library API Calls: Modified src/main.cpp to match the latest Firebase-ESP-Client API (e.g., Firebase.RTDB.pushJSON, json.set("timestamp/.sv", "timestamp"), firebaseData.setBSSLBufferSize(2048, 2048)). Removed Firebase.setReadTimeout().
  5. Attempted Manual Library Installation: Downloaded and placed the Firebase-ESP-Client-master folder directly into the project’s lib/ directory. Resulted in initial compile errors (header not found) due to manual pathing issues, then the same “missing credentials” error.
  6. Attempted lib_deps Installation (Specific Version & Latest):
  • Used lib_deps = Firebase-ESP-Client@^3.10.0 and later lib_deps = Firebase-ESP-Client (for latest version).
  • Consistently results in the Warning! Could not find the package with 'Firebase-ESP-Client...' requirements for your system 'darwin_arm64' error.
  1. Thorough Cleaning & Rebuilding: Repeatedly performed PlatformIO: Clean and PlatformIO: Clear cache, followed by closing/reopening VS Code and re-uploading the code.
  2. Enabled Firebase Debugging: Added #define FIREBASE_DEBUG as the very first line of src/main.cpp. Crucially, this has never produced any debug output in the serial monitor. Only the “Failed to send data…” error message appears.
  3. Opened VS Code using Rosetta 2: Attempted to run VS Code and PlatformIO in Rosetta 2 emulation mode to address the darwin_arm64 compatibility. Still results in the Warning! Could not find the package... error and no debug output.

Current Situation: The core problem seems to be that PlatformIO cannot properly install or link the Firebase-ESP-Client library for my darwin_arm64 system. This prevents any Firebase code from running correctly, leading to the persistent “missing credentials” error and the complete lack of debug output.

Request for Help: Has anyone encountered this specific darwin_arm64 package resolution warning with Firebase-ESP-Client on PlatformIO? Are there specific workarounds, alternative library versions, or build configurations required for Apple Silicon Macs for this library? Why would FIREBASE_DEBUG produce no output despite being enabled?

platformio.ini:

[env:esp32dev]
platform = espressif32
board = esp32dev
framework = arduino
monitor_speed = 115200
upload_speed = 460800
lib_deps =
# Currently attempting to install latest version
Firebase-ESP-Client

src/main.cpp:

#define FIREBASE_DEBUG // <-- This is the very first line, but no debug output appears.
#include <Arduino.h>
#include <WiFi.h>
#include <Firebase_ESP_Client.h> // Include the Firebase library

// 1. Wi-Fi Credentials 
#define WIFI_SSID "987apple" // 
#define WIFI_PASSWORD "***********" // 

// 2. Firebase Project Credentials (Anonymized for public post)
#define FIREBASE_HOST "https://smart-mail-box-bba77-default-mbstjnb.firebaseio.com"
#define FIREBASE_AUTH "XXXXXXXXXXXXXXXXXXXXXXXXX"

// Define the GPIO pin connected to the IR sensor's output
const int IR_SENSOR_PIN = 15; // You connected IR output to ESP D15 (GPIO 15)

// Firebase objects
FirebaseData firebaseData;
FirebaseAuth firebaseAuth;
FirebaseConfig firebaseConfig;

// State variables for sensor and notification
int irSensorState = HIGH;
bool mailDetectedFlag = false; // Flag to ensure message sent only once per detection cycle

unsigned long lastSendTime = 0;
const long sendInterval = 5000; // Minimum 5 seconds between sends to prevent spamming

void setup() {
  Serial.begin(115200);
  Serial.println("Smart Mailbox System - Firebase & IR Test");

  pinMode(IR_SENSOR_PIN, INPUT); // Configure IR sensor pin as input

  // Connect to Wi-Fi
  Serial.print("Connecting to Wi-Fi");
  WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
  while (WiFi.status() != WL_CONNECTED) {
    Serial.print(".");
    delay(500);
  }
  Serial.println("\nWi-Fi Connected!");
  Serial.print("IP Address: ");
  Serial.println(WiFi.localIP());

  // Configure Firebase
  firebaseConfig.host = FIREBASE_HOST;
  firebaseConfig.api_key = FIREBASE_AUTH;

  // Sign up for anonymous auth (simpler for testing, adjust as needed for production)
  // Required for Realtime Database if rules are public or using Anonymous Auth
  firebaseAuth.user.email = "";
  firebaseAuth.user.password = "";

  // Initialize Firebase
  Firebase.begin(&firebaseConfig, &firebaseAuth);
  Firebase.reconnectWiFi(true); // Reconnect Wi-Fi automatically if disconnected

  // Set the size of database payload (optional, default is 1024)
  // Corrected setBSSLBufferSize to accept two arguments (RX and TX)
  firebaseData.setBSSLBufferSize(2048, 2048); // Set both RX and TX buffer sizes
}

void loop() {
  // Check Wi-Fi connection and re-establish if lost
  if (WiFi.status() != WL_CONNECTED) {
    Serial.println("Reconnecting to Wi-Fi...");
    WiFi.reconnect();
    return; // Skip sensor check until connected
  }

  // Handle Firebase keep-alive (important for continuous operation)
  if (Firebase.ready()) {
    // This is optional, but helps maintain connection
    // Firebase.idle(); // Use if not doing frequent operations, otherwise Firebase.loop() handles it
  }

  irSensorState = digitalRead(IR_SENSOR_PIN);

  // Detect object (mail) - assuming LOW means object detected
  if (irSensorState == LOW && !mailDetectedFlag) {
    if (millis() - lastSendTime > sendInterval) { // Simple debounce/cooldown
      Serial.println("Object Detected! Sending data to Firebase...");

      // Create JSON object to send
      FirebaseJson json;
      json.set("status", "Mailbox opened / New mail detected");
      // Corrected way to get a server-generated timestamp in latest library versions
      json.set("timestamp/.sv", "timestamp"); // This tells Firebase to use its server time for this field

      // Push a new entry to the "/mailbox_events" path in Realtime Database
      if (Firebase.RTDB.pushJSON(&firebaseData, "/mailbox_events", &json)) {
        Serial.println("Data sent to Firebase successfully!");
        Serial.print("Path: ");
        Serial.println(firebaseData.dataPath());
        Serial.print("Key: ");
        Serial.println(firebaseData.pushName());
      } else {
        Serial.print("Failed to send data to Firebase: ");
        Serial.println(firebaseData.errorReason());
      }

      mailDetectedFlag = true; // Set flag to true to prevent continuous sending
      lastSendTime = millis();
    }
  }
  // Reset flag when object is no longer detected (assuming HIGH means no object)
  else if (irSensorState == HIGH && mailDetectedFlag) {
    Serial.println("No object detected. Resetting flag.");
    mailDetectedFlag = false; // Reset flag to allow new detection
  }

  // A short delay to prevent overwhelming the ESP32
  delay(100);
}

There is no library with such a name. See for yourself in the registry. There is only a repository by user mobiz with that name. The library itself has a name that is

And is as such registered under

https://registry.platformio.org/libraries/mobizt/Firebase%20Arduino%20Client%20Library%20for%20ESP8266%20and%20ESP32

Meaning the correct way for inclusion would be to refer to is as

lib_deps =
  mobizt/Firebase Arduino Client Library for ESP8266 and ESP32@^4.4.17
  ; other libraries..

How can the firmware be compiled if its missing the Firebase library? What is your full platformio.ini?

thanks fot your reply i have tried this with mobizt its still not working its showing the same line of output that “Failed to send data to Firebase: missing required credentials e.g., database URL, host and tokens.”
to answer your questions thats true i have added that and the full platform.ini is:
[env:esp32dev]

platform = espressif32

board = esp32dev

framework = arduino

monitor_speed = 115200

lib_deps = mobizt/Firebase Arduino Client Library for ESP8266 and ESP32@^4.4.17

Check the library’s README:

[!WARNING] This library is now deprecated and end of life. No further supports for help and feature request. We recommended the FirebaseClient library for ongoing supports. You have to read the library documentation thoroughly before use.

The new async FirebaseClient library is now availavle in Arduino IDE and PlatformIO’s Library Manager.