REFUSAL to compile if api.platformio.org is down!
See original GitHub issueWhat 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:
- Created 4 years ago
- Comments:10 (4 by maintainers)
@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:
api.platformio.org
, if the reply does not include the expected json* then: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
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.