Я пытаюсь развернуть функцию Firebase в Python. В файле main.py я определяю базовый сервер Flask, этот main.py imports fetch.py (еще один файл -сайный каталог - с моим исходным кодом). Файл fetch.py использует пакет Python Javascript. Я также добавил JavaScript topest.txt. Этот пакет нуждается в Node.js, установленном в среде. Есть ли какой -нибудь простой способ добавить node.js? Вызов этой команды развертывания < /p>
gcloud functions deploy fetchPython \
--gen2 \
--runtime=python311 \
--region=us-central1 \
--entry-point=app \
--trigger-http \
--allow-unauthenticated
< /code>
Результаты в этом < /p>
ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Could not create or update Cloud Run service fetchpython, Container Healthcheck failed. Revision 'fetchpython-00003-muh' is not ready and cannot serve traffic. The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable within the allocated timeout. This can happen when the container port is misconfigured or if the timeout is too short. The health check timeout can be extended. Logs for this revision might contain more information.
Запуск журналов функций gcloud Read Fetchpython-region = us-central1 i get:
LEVEL NAME EXECUTION_ID TIME_UTC LOG
E fetchpython 2025-04-17 21:54:58.739 Default STARTUP TCP probe failed 1 time consecutively for container "worker" on port 8080. The instance was not started.
Connection failed with status CANCELLED.
fetchpython 2025-04-17 21:54:58.649 Exception: Timed out accessing 'console'
WARNING fetchpython 2025-04-17 21:54:58.649 Container called exit(1).
fetchpython 2025-04-17 21:54:58.345 raise Exception(f"Timed out accessing '{attr}'")
fetchpython 2025-04-17 21:54:58.345 File "/layers/google.python.pip/pip/lib/python3.11/site-packages/javascript/proxy.py", line 43, in ipc
fetchpython 2025-04-17 21:54:58.345 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
fetchpython 2025-04-17 21:54:58.345 resp = self.ipc("get", ffid, method)
fetchpython 2025-04-17 21:54:58.345 File "/layers/google.python.pip/pip/lib/python3.11/site-packages/javascript/proxy.py", line 150, in getProp
fetchpython 2025-04-17 21:54:58.345 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
fetchpython 2025-04-17 21:54:58.345 methodType, val = self._exe.getProp(self._pffid, attr)
fetchpython 2025-04-17 21:54:58.343 File "/layers/google.python.pip/pip/lib/python3.11/site-packages/javascript/proxy.py", line 230, in __getattr__
fetchpython 2025-04-17 21:54:58.343 ^^^^^^^^^^^^^^^^^^^^^^^^^
fetchpython 2025-04-17 21:54:58.343 console = config.global_jsi.console # TODO: Remove this in 1.0
fetchpython 2025-04-17 21:54:58.343 File "/layers/google.python.pip/pip/lib/python3.11/site-packages/javascript/__init__.py", line 18, in init
fetchpython 2025-04-17 21:54:58.343 init()
fetchpython 2025-04-17 21:54:58.341 File "/layers/google.python.pip/pip/lib/python3.11/site-packages/javascript/__init__.py", line 27, in
fetchpython 2025-04-17 21:54:58.341 from javascript import require
fetchpython 2025-04-17 21:54:58.341 File "/workspace/fetch.py", line 2, in
fetchpython 2025-04-17 21:54:58.341 from fetch import KeyFetcher
fetchpython 2025-04-17 21:54:58.341 File "/workspace/main.py", line 3, in
main.py
from flask import Flask, request, jsonify
from google.cloud import firestore
from fetch import KeyFetcher
import os
app = Flask(__name__)
db = firestore.Client()
@app.route('/keys', methods=['POST'])
def call_fetch():
data = request.json
version = data.get("version")
if not version:
return jsonify({"error": "Version is required"}), 401
try:
result = KeyFetcher(version).fetch_keys()
except Exception as e:
return jsonify({"parse error": e}), 401
return jsonify({"result": result}), 200
if __name__ == '__main__':
port = int(os.environ.get('PORT', 8080))
app.run(host='0.0.0.0', port=port)
fetch.py
import base64, os, re, tempfile, threading, esprima
from javascript import require
from functools import wraps
from logger import Logger
from wasm import Wasm
import jsbeautifier
import requests
import binascii
import sys, os
import base64
import re
# My code here
< /code>
requirements.txt
firebase_functions~=0.1.0
flask
google-cloud-firestore
jsbeautifier
requests
esprima
javascript
colorama
Подробнее здесь: https://stackoverflow.com/questions/795 ... e-function
Добавление узла в функцию Fython Firebase ⇐ Javascript
Форум по Javascript
1744928183
Anonymous
Я пытаюсь развернуть функцию Firebase в Python. В файле main.py я определяю базовый сервер Flask, этот main.py imports fetch.py (еще один файл -сайный каталог - с моим исходным кодом). Файл fetch.py использует пакет Python Javascript. Я также добавил JavaScript topest.txt. Этот пакет нуждается в Node.js, установленном в среде. Есть ли какой -нибудь простой способ добавить node.js? Вызов этой команды развертывания < /p>
gcloud functions deploy fetchPython \
--gen2 \
--runtime=python311 \
--region=us-central1 \
--entry-point=app \
--trigger-http \
--allow-unauthenticated
< /code>
Результаты в этом < /p>
ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Could not create or update Cloud Run service fetchpython, Container Healthcheck failed. Revision 'fetchpython-00003-muh' is not ready and cannot serve traffic. The user-provided container failed to start and listen on the port defined provided by the PORT=8080 environment variable within the allocated timeout. This can happen when the container port is misconfigured or if the timeout is too short. The health check timeout can be extended. Logs for this revision might contain more information.
Запуск журналов функций gcloud Read Fetchpython-region = us-central1 i get:
LEVEL NAME EXECUTION_ID TIME_UTC LOG
E fetchpython 2025-04-17 21:54:58.739 Default STARTUP TCP probe failed 1 time consecutively for container "worker" on port 8080. The instance was not started.
Connection failed with status CANCELLED.
fetchpython 2025-04-17 21:54:58.649 Exception: Timed out accessing 'console'
WARNING fetchpython 2025-04-17 21:54:58.649 Container called exit(1).
fetchpython 2025-04-17 21:54:58.345 raise Exception(f"Timed out accessing '{attr}'")
fetchpython 2025-04-17 21:54:58.345 File "/layers/google.python.pip/pip/lib/python3.11/site-packages/javascript/proxy.py", line 43, in ipc
fetchpython 2025-04-17 21:54:58.345 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
fetchpython 2025-04-17 21:54:58.345 resp = self.ipc("get", ffid, method)
fetchpython 2025-04-17 21:54:58.345 File "/layers/google.python.pip/pip/lib/python3.11/site-packages/javascript/proxy.py", line 150, in getProp
fetchpython 2025-04-17 21:54:58.345 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
fetchpython 2025-04-17 21:54:58.345 methodType, val = self._exe.getProp(self._pffid, attr)
fetchpython 2025-04-17 21:54:58.343 File "/layers/google.python.pip/pip/lib/python3.11/site-packages/javascript/proxy.py", line 230, in __getattr__
fetchpython 2025-04-17 21:54:58.343 ^^^^^^^^^^^^^^^^^^^^^^^^^
fetchpython 2025-04-17 21:54:58.343 console = config.global_jsi.console # TODO: Remove this in 1.0
fetchpython 2025-04-17 21:54:58.343 File "/layers/google.python.pip/pip/lib/python3.11/site-packages/javascript/__init__.py", line 18, in init
fetchpython 2025-04-17 21:54:58.343 init()
fetchpython 2025-04-17 21:54:58.341 File "/layers/google.python.pip/pip/lib/python3.11/site-packages/javascript/__init__.py", line 27, in
fetchpython 2025-04-17 21:54:58.341 from javascript import require
fetchpython 2025-04-17 21:54:58.341 File "/workspace/fetch.py", line 2, in
fetchpython 2025-04-17 21:54:58.341 from fetch import KeyFetcher
fetchpython 2025-04-17 21:54:58.341 File "/workspace/main.py", line 3, in
[b] main.py[/b]
from flask import Flask, request, jsonify
from google.cloud import firestore
from fetch import KeyFetcher
import os
app = Flask(__name__)
db = firestore.Client()
@app.route('/keys', methods=['POST'])
def call_fetch():
data = request.json
version = data.get("version")
if not version:
return jsonify({"error": "Version is required"}), 401
try:
result = KeyFetcher(version).fetch_keys()
except Exception as e:
return jsonify({"parse error": e}), 401
return jsonify({"result": result}), 200
if __name__ == '__main__':
port = int(os.environ.get('PORT', 8080))
app.run(host='0.0.0.0', port=port)
[b]fetch.py[/b]
import base64, os, re, tempfile, threading, esprima
from javascript import require
from functools import wraps
from logger import Logger
from wasm import Wasm
import jsbeautifier
import requests
import binascii
import sys, os
import base64
import re
# My code here
< /code>
requirements.txt
firebase_functions~=0.1.0
flask
google-cloud-firestore
jsbeautifier
requests
esprima
javascript
colorama
Подробнее здесь: [url]https://stackoverflow.com/questions/79580170/adding-node-to-python-firebase-function[/url]
Ответить
1 сообщение
• Страница 1 из 1
Перейти
- Кемерово-IT
- ↳ Javascript
- ↳ C#
- ↳ JAVA
- ↳ Elasticsearch aggregation
- ↳ Python
- ↳ Php
- ↳ Android
- ↳ Html
- ↳ Jquery
- ↳ C++
- ↳ IOS
- ↳ CSS
- ↳ Excel
- ↳ Linux
- ↳ Apache
- ↳ MySql
- Детский мир
- Для души
- ↳ Музыкальные инструменты даром
- ↳ Печатная продукция даром
- Внешняя красота и здоровье
- ↳ Одежда и обувь для взрослых даром
- ↳ Товары для здоровья
- ↳ Физкультура и спорт
- Техника - даром!
- ↳ Автомобилистам
- ↳ Компьютерная техника
- ↳ Плиты: газовые и электрические
- ↳ Холодильники
- ↳ Стиральные машины
- ↳ Телевизоры
- ↳ Телефоны, смартфоны, плашеты
- ↳ Швейные машинки
- ↳ Прочая электроника и техника
- ↳ Фототехника
- Ремонт и интерьер
- ↳ Стройматериалы, инструмент
- ↳ Мебель и предметы интерьера даром
- ↳ Cантехника
- Другие темы
- ↳ Разное даром
- ↳ Давай меняться!
- ↳ Отдам\возьму за копеечку
- ↳ Работа и подработка в Кемерове
- ↳ Давай с тобой поговорим...
Мобильная версия