question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

REFUSAL to compile if api.platformio.org is down!

See original GitHub issue

What kind of issue is this?

  • Question. This issue tracker is not the place for questions. If you want to ask how to do something, or to understand why something isn’t working the way you expect it to, use Community Forums or Premium Support

  • PlatformIO IDE. All issues related to PlatformIO IDE should be reported to appropriate repository: PlatformIO IDE for Atom or PlatformIO IDE for VSCode

  • Development Platform or Board. All issues (building, uploading, adding new boards, etc.) related to PlatformIO development platforms should be reported to appropriate repository related to your hardware https://github.com/topics/platformio-platform

  • Feature Request. Start by telling us what problem you’re trying to solve. Often a solution already exists! Don’t send pull requests to implement new features without first getting our support. Sometimes we leave features out on purpose to keep the project small.

  • [x ] PlatformIO Core. If you’ve found a bug, please provide an information below.

You can erase any parts of this template not applicable to your Issue.


Configuration

Operating system:

PlatformIO Version (platformio --version):

4.1.0

Description of problem

If api.platformio.org is down then platformio refuses to compile. See this issue: https://github.com/esphome/issues/issues/948 NOTE: This is after the first compile ran successfully; after having downloaded all needed libraries (older versions than the current ones online).

Steps to Reproduce

Actual Results

Prints an exception and bails out. Example log:

esphome plug_1.yaml compile
INFO Reading configuration plug_1.yaml...
INFO Generating C++ source...
INFO Compiling app...
INFO Running:  platformio run -d plug_1
Processing plug_1 (board: esp8285; framework: arduino; platform: espressif8266@2.2.3)
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
HARDWARE: ESP8266 80MHz, 80KB RAM, 1MB Flash
Looking for ESPAsyncTCP-esphome library in registry
APIRequestError: [API] Invalid response: b'<html>\r\n<head><title>404 Not Found</title></head>\r\n<body bgcolor="white">\r\n<center><h1>404 Not Found</h1></center>\r\n<hr><center>nginx/1.14.0 (Ubuntu)</center>\r\n</body>\r\n</html>\r\n':
  File "/home/hassdev/.local/lib/python3.8/site-packages/platformio/builder/main.py", line 151:
    env.SConscript("$BUILD_SCRIPT")
  File "/home/hassdev/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py", line 605:
    return _SConscript(self.fs, *files, **subst_kw)
  File "/home/hassdev/.platformio/packages/tool-scons/script/../engine/SCons/Script/SConscript.py", line 286:
    exec(compile(scriptdata, scriptname, 'exec'), call_stack[-1].globals)
  File "/home/hassdev/.platformio/platforms/espressif8266/builder/main.py", line 203:
    target_elf = env.BuildProgram()
  File "/home/hassdev/.platformio/packages/tool-scons/script/../engine/SCons/Environment.py", line 224:
    return self.method(*nargs, **kwargs)
  File "/home/hassdev/.local/lib/python3.8/site-packages/platformio/builder/tools/platformio.py", line 140:
    _build_project_deps(env)
  File "/home/hassdev/.local/lib/python3.8/site-packages/platformio/builder/tools/platformio.py", line 48:
    project_lib_builder = env.ConfigureProjectLibBuilder()
  File "/home/hassdev/.platformio/packages/tool-scons/script/../engine/SCons/Environment.py", line 224:
    return self.method(*nargs, **kwargs)
  File "/home/hassdev/.local/lib/python3.8/site-packages/platformio/builder/tools/piolib.py", line 1027:
    project.install_dependencies()
  File "/home/hassdev/.local/lib/python3.8/site-packages/platformio/builder/tools/piolib.py", line 859:
    lm.install(uri)
  File "/home/hassdev/.local/lib/python3.8/site-packages/platformio/managers/lib.py", line 289:
    name = "id=%d" % self.search_lib_id(
  File "/home/hassdev/.local/lib/python3.8/site-packages/platformio/managers/lib.py", line 184:
    result = util.get_api_result(
  File "/home/hassdev/.local/lib/python3.8/site-packages/platformio/util.py", line 349:
    result = _get_api_result(url, params, data)
  File "/home/hassdev/.local/lib/python3.8/site-packages/platformio/util.py", line 81:
    return func(*args, **kwargs)
  File "/home/hassdev/.local/lib/python3.8/site-packages/platformio/util.py", line 323:
    raise exception.APIRequestError("Invalid response: %s" % r.text.encode("utf-8"))
==================================================================================== [FAILED] Took 0.87 seconds ====================================================================================

Expected Results

Print the exception and continue compiling with locally available libraries.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
erlangercommented, Dec 27, 2019

@ivankravets thanks for your reply, and for the fact that the website is up!

However, I don’t think it is really resolved, because the client still depends on the website being up in order to compile. What I would humbly suggest is to do the following in the code:

  1. Try to contact api.platformio.org, if the reply does not include the expected json* then:
  2. Print a warning and use the locally available dependencies to compile: “WARNING: Using locally available dependencies because of lack of response from api.platformio.org”
  3. If there are no locally available dependencies because it is the first time a compilation is done, then print an error and exit saying: “ERROR: first time compilation requires api.platformio.org to be accessible”

This will make the client resilient and stable.

Hopefully you will consider this, and thank you so much for your great work!

(*) This includes any kind of error, not just 4XX or 5XX or lack of network connectivity but even getting some unexpected json reply without the proper data

1reaction
erlangercommented, Dec 30, 2019

I see that you are being honest, and that you honestly think that the client is not forcing unneeded online access. I apologize for suggesting there may be other reasons.

api.platformio.org is down again and I can not compile.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Platformio reports certificate error, can not build locally
Right now, I am stuck with my project and I can't seem to find a workaround short of blocking this hostname locally or...
Read more >
Arduino unable to compile - PlatformIO Community
Hello, I am having a few issues in compiling an arduino program. This program will compile with the arduino ide. When I try...
Read more >
PlatformIO on VS Code does not find Libraries
I just wanted to make the switch to PlatformIO for Arduino. But I always get the same error: it does not find the...
Read more >
PlatformIO is Broken for any esp32!
The compilation still works fine for Arduino cards. When i try to create an empty project for any esp32 i get random empty...
Read more >
'Arduino.h' file not found - #28 by maxgerhardt - PlatformIO IDE
Either way, IntelliSense errors are shown in the Problems tab. ... I just press build/compile when I think I've finished something, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found