Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: upstream.upstreams() returns nil #2934

Open
ali-mahdavi-mehr opened this issue Mar 3, 2024 · 6 comments
Open

bug: upstream.upstreams() returns nil #2934

ali-mahdavi-mehr opened this issue Mar 3, 2024 · 6 comments

Comments

@ali-mahdavi-mehr
Copy link

Current Behavior

When we update the upstreams in the dashboard, this value becomes nil.
local upstreams, _ = upstream.upstreams()

Expected Behavior

Since APISIX is real-time, upstreams should be updated as soon as they are updated in the dashboard.

Error Logs

local upstreams, _ = upstream.upstreams()
upstream is a nil value

Steps to Reproduce

1- update the upstreams in the dashboard

Environment

  • APISIX version : 3.8.0
  • APISIX Dashboard version: 3.0.0-alpine
@ali-mahdavi-mehr ali-mahdavi-mehr changed the title bug: upstream.upstreams() return nil bug: upstream.upstreams() returns nil Mar 3, 2024
@ali-mahdavi-mehr
Copy link
Author

When an upstream is deleted, this error occurs even if no route uses it.

@theweakgod
Copy link

Could u please show me ur config.yaml of apisix and conf.yaml of dashboard?

@ali-mahdavi-mehr
Copy link
Author

Could u please show me ur config.yaml of apisix and conf.yaml of dashboard?

APISIX config

apisix:
  node_listen: 9080
  enable_ipv6: false
  enable_control: true
  control:
    ip: "0.0.0.0"
    port: 9092

  extra_lua_path: "/lua_extra/?.lua"
  extra_lua_cpath: ""

deployment:
  admin:
    allow_admin:
      - 0.0.0.0/0

  etcd:
    host:
      - "http://etcd:2379"
    prefix: "/apisix"
    timeout: 30

plugin_attr:
  prometheus:
    export_addr:
      ip: "0.0.0.0"
      port: 9091
    metrics:
      http_status:
        extra_labels:
          - upstream_addr: $upstream_addr
      http_latency:
        extra_labels:
          - upstream_addr: $upstream_addr
      bandwidth:
        extra_labels:
          - upstream_addr: $upstream_addr

nginx_config:
  envs:
    - NGINX_PORT

plugins:
  - api-breaker
  - authz-keycloak
  - basic-auth
  - batch-requests
  - consumer-restriction
  - cors
  - ext-plugin-post-resp
  - ext-plugin-post-req
  - ext-plugin-pre-req
  - fault-injection
  - grpc-transcode
  - hmac-auth
  - http-logger
  - ip-restriction
  - jwt-auth
  - kafka-logger
  - key-auth
  - limit-conn
  - limit-count
  - limit-req
  - openid-connect
  - prometheus
  - proxy-cache
  - proxy-mirror
  - proxy-rewrite
  - redirect
  - referer-restriction
  - request-id
  - request-validation
  - response-rewrite
  - serverless-post-function
  - serverless-pre-function
  - sls-logger
  - tcp-logger
  - udp-logger
  - uri-blocker
  - wolf-rbac
  - zipkin
  - server-info
  - traffic-split
  - elasticsearch-logger


ext-plugin:
  cmd: ["/plugins/go-runner", "run"]
  path_for_test: /tmp/runner.sock

Dashboard config:

conf:
  listen:
    host: 0.0.0.0
    port: 9000
  allow_list:
    - 0.0.0.0/0
  etcd:
    endpoints:
      - "http://etcd:2379"

    mtls:
      key_file: ""
      cert_file: ""
      ca_file: ""

  log:
    error_log:
      level: warn 
      file_path:
        logs/error.log 
                    
    access_log:
      file_path:
        logs/access.log 
  security:
      content_security_policy: "default-src 'self'; script-src 'self' 'unsafe-eval' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; frame-src *"

authentication:
  enable: false
  secret:
    secret
                        
  expire_time: 360000     
  users:                
    - username: admin   
      password: admin
    - username: user
      password: user

plugins:                      
  - api-breaker
  - authz-keycloak
  - basic-auth
  - batch-requests
  - consumer-restriction
  - cors
  - echo
  - fault-injection
  - grpc-transcode
  - hmac-auth
  - http-logger
  - ip-restriction
  - jwt-auth
  - kafka-logger
  - key-auth
  - limit-conn
  - limit-count
  - limit-req
  - openid-connect
  - prometheus
  - proxy-cache
  - proxy-mirror
  - proxy-rewrite
  - redirect
  - referer-restriction
  - request-id
  - request-validation
  - response-rewrite
  - serverless-post-function
  - serverless-pre-function
  - sls-logger
  - tcp-logger
  - udp-logger
  - uri-blocker
  - wolf-rbac
  - zipkin
  - server-info
  - traffic-split
  - ext-plugin-post-resp
  - ext-plugin-post-req
  - ext-plugin-pre-req
  - elasticsearch-logger


@theweakgod
Copy link

  etcd:
    host:
      - "http://etcd:2379"
    prefix: "/apisix"
    timeout: 30
etcd:
   endpoints:
     - "http://etcd:2379"

You might need to change it to the correct host instead of using etcd:2379, as DNS might not resolve correctly.

@ali-mahdavi-mehr
Copy link
Author

  etcd:
    host:
      - "http://etcd:2379"
    prefix: "/apisix"
    timeout: 30
etcd:
   endpoints:
     - "http://etcd:2379"

You might need to change it to the correct host instead of using etcd:2379, as DNS might not resolve correctly.

I set the value but no change occurred.

@hanqingwu
Copy link

Can you provide some logs about apisix , please?

@shreemaan-abhishek shreemaan-abhishek transferred this issue from apache/apisix Mar 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 📋 Backlog
Development

No branches or pull requests

3 participants