Error while posting something from Esp32 to firebase

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
WoLvES
Posts: 1
Joined: Sun Feb 27, 2022 1:32 am

Error while posting something from Esp32 to firebase

Post by WoLvES » Sun Feb 27, 2022 1:37 am

I'm trying to use firebase with Micropython. It doesn't matter how many times I do this print(firebase.get(URL)). If I use firebase.put(URL, datas) or firebase.patch(URL, datas) then it successfully posts that data, but if I try to read the data print(firebase.get(URL)) then this error pops up.

Firebase library: https://github.com/vishal-android-freak ... thon-esp32

Code:

Code: Select all

    import network
    import ufirebase as firebase
    from time import sleep
    
    URL = 'https://xxxxxxxxxxxxxxxx.firebaseio.com/'
    
    wlan = network.WLAN(network.STA_IF)
    if not wlan.active() or not wlan.isconnected():
        wlan.active(True)
        print('connecting to: xxxx')
        wlan.connect('xxxx', 'xxxxxxxxx')
        while not wlan.isconnected():
            pass
    print('network config:', wlan.ifconfig())
    datas = {'Shape': {'hos': 'fse', 'xxe': 'ter'}, 'Wps': 'Wps'}
    
    firebase.put(URL, datas)
    sleep(5)
    print(firebase.get(URL))

Error:

Code: Select all

    Traceback (most recent call last):
      File "main.py", line 21, in <module>
      File "ufirebase.py", line 124, in get
      File "urequests.py", line 116, in get
      File "urequests.py", line 62, in request
    OSError: [Errno 12] ENOMEM
    MicroPython v1.18 on 2022-01-17; 4MB/OTA module with ESP32
    Type "help()" for more information.

BetterAutomations
Posts: 84
Joined: Mon Mar 20, 2017 10:22 pm

Re: Error while posting something from Esp32 to firebase

Post by BetterAutomations » Sun Apr 10, 2022 11:13 pm

Not 100% sure but I think ENOMEM means you've run out of memory. Are you using a module with SPIRAM? Did you flash it with the SPIRAM firmware? And if you did, are you regularly running gc.collect()?

Post Reply