reflex icon indicating copy to clipboard operation
reflex copied to clipboard

how to set up crossDomain

Open mayq97 opened this issue 3 years ago β€’ 11 comments

Describe the bug Unhandled Runtime Error AxiosError: Request failed with status code 404

mayq97 avatar Dec 19 '22 03:12 mayq97

Hi can you give us a little more context. Code you were running, python version, os etc. Thanks

Alek99 avatar Dec 19 '22 04:12 Alek99

pynecone-io 0.1.10 node v19.3.0 the code is https://github.com/pynecone-io/pynecone-examples/tree/main/gpt

mayq97 avatar Dec 19 '22 04:12 mayq97

pc run --env prod ───────────────────────────────────────────────────────────────────────────────────── Starting Pynecone App ───────────────────────────────────────────────────────────────────────────────────── Skipping compilation in non-dev mode. ───────────────────────────────────────────────────────────────────────────────── Installing frontend packages ────────────────────────────────────────────────────────────────────────────────── bun install v0.3.0 (a13e64c2) $ next build && next export -o _static info - Linting and checking validity of types

Build error occurred [Error: ENOENT: no such file or directory, stat './.web/public'] { errno: -2, code: 'ENOENT', syscall: 'stat', path: './.web/public' } info - Creating an optimized production build .Script error "export" exited with 1 status $ next start Error: listen EADDRINUSE: address already in use 0.0.0.0:9099 at Server.setupListenHandle [as _listen2] (node:net:1717:16) at listenInCluster (node:net:1765:12) at doListen (node:net:1914:7) at process.processTicksAndRejections (node:internal/process/task_queues:83:21) { code: 'EADDRINUSE', errno: -98, syscall: 'listen', address: '0.0.0.0', port: 9099 } Script error "prod" exited with 1 status [2022-12-19 12:36:28 +0800] [32631] [DEBUG] Current configuration: config: ./gunicorn.conf.py wsgi_app: None bind: ['0.0.0.0:8000'] backlog: 2048 workers: 1 worker_class: uvicorn.workers.UvicornH11Worker threads: 1 worker_connections: 1000 max_requests: 0 max_requests_jitter: 0 timeout: 120 graceful_timeout: 30 keepalive: 2 limit_request_line: 4094 limit_request_fields: 100 limit_request_field_size: 8190 reload: False reload_engine: auto reload_extra_files: [] spew: False check_config: False print_config: False preload_app: True sendfile: None reuse_port: False chdir: . daemon: False raw_env: [] pidfile: None worker_tmp_dir: None user: 1000 group: 1000 umask: 0 initgroups: False tmp_upload_dir: None secure_scheme_headers: {'X-FORWARDED-PROTOCOL': 'ssl', 'X-FORWARDED-PROTO': 'https', 'X-FORWARDED-SSL': 'on'} forwarded_allow_ips: ['127.0.0.1'] accesslog: None disable_redirect_access_to_syslog: False access_log_format: %(h)s %(l)s %(u)s %(t)s "%(r)s" %(s)s %(b)s "%(f)s" "%(a)s" errorlog: - loglevel: debug capture_output: False logger_class: gunicorn.glogging.Logger logconfig: None logconfig_dict: {} syslog_addr: udp://localhost:514 syslog: False syslog_prefix: None syslog_facility: user enable_stdio_inheritance: False statsd_host: None dogstatsd_tags: statsd_prefix: proc_name: None default_proc_name: gpt.gpt:app() pythonpath: None paste: None on_starting: <function OnStarting.on_starting at 0x7fd3e5be3670> on_reload: <function OnReload.on_reload at 0x7fd3e5be3790> when_ready: <function WhenReady.when_ready at 0x7fd3e5be38b0> pre_fork: <function Prefork.pre_fork at 0x7fd3e5be39d0> post_fork: <function Postfork.post_fork at 0x7fd3e5be3af0> post_worker_init: <function PostWorkerInit.post_worker_init at 0x7fd3e5be3c10> worker_int: <function WorkerInt.worker_int at 0x7fd3e5be3d30> worker_abort: <function WorkerAbort.worker_abort at 0x7fd3e5be3e50> pre_exec: <function PreExec.pre_exec at 0x7fd3e5be3f70> pre_request: <function PreRequest.pre_request at 0x7fd3e5b770d0> post_request: <function PostRequest.post_request at 0x7fd3e5b77160> child_exit: <function ChildExit.child_exit at 0x7fd3e5b77280> worker_exit: <function WorkerExit.worker_exit at 0x7fd3e5b773a0> nworkers_changed: <function NumWorkersChanged.nworkers_changed at 0x7fd3e5b774c0> on_exit: <function OnExit.on_exit at 0x7fd3e5b775e0> proxy_protocol: False proxy_allow_ips: ['127.0.0.1'] keyfile: None certfile: None ssl_version: 2 cert_reqs: 0 ca_certs: None suppress_ragged_eofs: True do_handshake_on_connect: False ciphers: None raw_paste_global_conf: [] strip_header_spaces: False Skipping compilation in non-dev mode. [2022-12-19 12:36:29 +0800] [32631] [INFO] Starting gunicorn 20.1.0 [2022-12-19 12:36:29 +0800] [32631] [ERROR] Connection in use: ('0.0.0.0', 8000) [2022-12-19 12:36:29 +0800] [32631] [DEBUG] connection to ('0.0.0.0', 8000) failed: [Errno 98] Address already in use [2022-12-19 12:36:29 +0800] [32631] [ERROR] Retrying in 1 second. [2022-12-19 12:36:30 +0800] [32631] [ERROR] Connection in use: ('0.0.0.0', 8000) [2022-12-19 12:36:30 +0800] [32631] [DEBUG] connection to ('0.0.0.0', 8000) failed: [Errno 98] Address already in use [2022-12-19 12:36:30 +0800] [32631] [ERROR] Retrying in 1 second. [2022-12-19 12:36:31 +0800] [32631] [ERROR] Connection in use: ('0.0.0.0', 8000) [2022-12-19 12:36:31 +0800] [32631] [DEBUG] connection to ('0.0.0.0', 8000) failed: [Errno 98] Address already in use [2022-12-19 12:36:31 +0800] [32631] [ERROR] Retrying in 1 second. [2022-12-19 12:36:32 +0800] [32631] [ERROR] Connection in use: ('0.0.0.0', 8000) [2022-12-19 12:36:32 +0800] [32631] [DEBUG] connection to ('0.0.0.0', 8000) failed: [Errno 98] Address already in use [2022-12-19 12:36:32 +0800] [32631] [ERROR] Retrying in 1 second. [2022-12-19 12:36:33 +0800] [32631] [ERROR] Connection in use: ('0.0.0.0', 8000) [2022-12-19 12:36:33 +0800] [32631] [DEBUG] connection to ('0.0.0.0', 8000) failed: [Errno 98] Address already in use [2022-12-19 12:36:33 +0800] [32631] [ERROR] Retrying in 1 second. [2022-12-19 12:36:34 +0800] [32631] [ERROR] Can't connect to ('0.0.0.0', 8000)

mayq97 avatar Dec 19 '22 04:12 mayq97

Was this on the initial running or when you triggered the open ai function because you need to use your own key for that

Alek99 avatar Dec 19 '22 04:12 Alek99

does pc run work, when its non prod?

Alek99 avatar Dec 19 '22 04:12 Alek99

图片

i remove the code for open ai

mayq97 avatar Dec 19 '22 04:12 mayq97

图片

mayq97 avatar Dec 19 '22 07:12 mayq97

Tell him to show POST request:

θΏ™δΈͺ OPTIONS ζ˜―ι’„ζ£€θ―·ζ±‚οΌŒηœŸζ­£ηš„θ―·ζ±‚εœ¨δΈ‹ι’ι‚£δΈͺ POST ι‡Œι’

FHU-yezi avatar Dec 19 '22 08:12 FHU-yezi

RUN_BACKEND_PROD δΈ­ηš„η«―ε£ιœ€θ¦ε’Œapi δΈ­ηš„η«―ε£δΏζŒδΈ€θ‡΄

import pynecone as pc from pynecone import constants

constants.RUN_BACKEND_PROD = f"gunicorn --worker-class uvicorn.workers.UvicornH11Worker --bind 0.0.0.0:8056 --preload --timeout {constants.TIMEOUT} --log-level debug".split()

config = pc.Config( app_name="demo", bun_path="$HOME/.bun/bin/bun", api_url="http://127.0.0.1:8056", deploy_url="http://127.0.0.:8055", db_url="sqlite:///pynecone.db", env=pc.Env.DEV, )

prod

PORT=8055 pc run --env prod

mayq97 avatar Dec 20 '22 11:12 mayq97

Translation for non-chinese contributor:

The port set in RUN_BACKEND_PORT should be the same as your API port.

Yes, because we use this port argument to generate static frontend files.

FHU-yezi avatar Dec 20 '22 13:12 FHU-yezi

Yes currently the API port must be on port 8000 which may be causing the issue. We need to add a way to configure the port.

picklelo avatar Dec 20 '22 17:12 picklelo