FlowFuse / flowfuse

Connect, collect, transform, visualise, and interact with your Industrial Data in a single platform. Use FlowFuse to manage, scale and secure your Node-RED solutions.
https://flowfuse.com
Other
277 stars 63 forks source link

http in node - related question. #4482

Closed VINISHVV closed 1 month ago

VINISHVV commented 1 month ago

Current Behavior

Dear All,

I am a big fan of node-red projects from last one year. Recently i installed a flowfuse self hosted version for upgrade existing node-red flows.

I have created a new instance in flowfuse which is accessible from both editor menu and directly accessible through the domain name shown in flowfuse.

I have added an http in node in the new instance flow which support post methods. But i m unable to send any data to this node as its showing error.

can you help with this issue.

Expected Behavior

The flow needs to starts basis the input received in the http in node.

Steps To Reproduce

Create a new instance. and deploy required flows. Map the domain A record for access the new instance add an http in node in the newly created instance. initiate a post method APi call to the end point created.

Environment

Have you provided an initial effort estimate for this issue?

I have provided an initial effort estimate

hardillb commented 1 month ago

Hello,

Can you share some more details about this please, specifically the errors that are shown, and also fill out the environment section of the template so we know what version of FlowFuse and how you installed it.

Also how big is the data you are posting to the http-in node path?

VINISHVV commented 1 month ago

@hardillb - modified the details

hardillb commented 1 month ago

@VINISHVV You've not shown the error or said how you are running FlowFuse (Docker or Kubernetes).

Without knowing the error we can't know what the problem might be

VINISHVV commented 1 month ago

@hardillb i am running my flowfuse in AWS ( https://aws.amazon.com/marketplace/search?prevFilters=%257B%2522ref_%2522%3A%2522mp_nav_category_96c2cd16-fe69-4b18-99cc-e016c61e820c%2522%2C%2522category%2522%3A%252296c2cd16-fe69-4b18-99cc-e016c61e820c%2522%257D&searchTerms=flowfuse )

Error i am gtting in postman

image

hardillb commented 1 month ago

OK, that is returning the flowfuse home page. Which implies that the request is being sent to the hostname for the FlowFuse application, not the Node-RED instance.

To help we really are going to need to know the hostnames you are using here and how you've setup the DNS.

Assuming the following:

Then you should be pointing postman at https://instance1.example.com/path where /path is the value entered into the http-in node config dialog.

If that is what you are using, then I will need to see the logs from the nginx container in the AWS machine.

hardillb commented 1 month ago

But the fact you said you can access the Node-RED editor on it's dedicated hostname that implies that nginx should be working correctly

VINISHVV commented 1 month ago

OK, that is returning the flowfuse home page. Which implies that the request is being sent to the hostname for the FlowFuse application, not the Node-RED instance.

To help we really are going to need to know the hostnames you are using here and how you've setup the DNS.

Assuming the following:

  • The FlowFuse application is running on forge.example.com
  • The instance is running on instance1.example.com

Then you should be pointing postman at https://instance1.example.com/path where /path is the value entered into the http-in node config dialog.

If that is what you are using, then I will need to see the logs from the nginx container in the AWS machine.

Your understanding is absolutely correct!

VINISHVV commented 1 month ago

But the fact you said you can access the Node-RED editor on it's dedicated hostname that implies that nginx should be working correctly

i can access the editor using the domain name ( example https://instance1.example.com )

hardillb commented 1 month ago

Then as I said I'll need access to the following:

You can get both of these by using SSH to connect to the AWS EC2 machine, the same as when you ran through the setup wizard when you installed from the marketplace.

VINISHVV commented 1 month ago

@hardillb

Nginx log showing below output.

nginx.1     | instance.xxxxx.org 223.31.157.134 - - [14/Sep/2024:04:28:45 +0000] "POST /GooglePay4 HTTP/1.1" 302 0 "-" "PostmanRuntime/7.29.0" "172.18.0.8:1880"
nginx.1     | forge.xxxxx.org 223.31.157.134 - - [14/Sep/2024:04:28:45 +0000] "GET /account/authorize?response_type=code&redirect_uri=https%3A%2F%2Finstance.xxxxx.org%2F_ffAuth%2Fcallback&scope=httpAuth-2.8.0&code_challenge=VzhULZDkTABSFinyPRc9BYUqfa0gleGjs1Oy8D03Htg&code_challenge_method=S256&state=MYFpBSp7xSbK5YRTmx9F8sXy&client_id=ffp_jozYag-8R72G-AG5f07U2oAcvb9RE8n8yw0h6Z_4OCA HTTP/1.1" 302 0 "https://instance.xxxxx.org/GooglePay4" "PostmanRuntime/7.29.0" "172.18.0.2:3000"
nginx.1     | forge.xxxxx.org 223.31.157.134 - - [14/Sep/2024:04:28:45 +0000] "GET /account/request/Uo-Vc4dleGmiLg8jUg3ML0GxgYEok5goolp1qsEmTnE/editor HTTP/1.1" 200 954 "https://forge.xxxxx.org/account/authorize?response_type=code&redirect_uri=https%3A%2F%2Finstance.xxxxx.org%2F_ffAuth%2Fcallback&scope=httpAuth-2.8.0&code_challenge=VzhULZDkTABSFinyPRc9BYUqfa0gleGjs1Oy8D03Htg&code_challenge_method=S256&state=MYFpBSp7xSbK5YRTmx9F8sXy&client_id=ffp_jozYag-8R72G-AG5f07U2oAcvb9RE8n8yw0h6Z_4OCA" "PostmanRuntime/7.29.0" "172.18.0.2:3000"

Flowfuse config

port: 3000
host: 0.0.0.0
domain: xxxxxx.org
base_url: https://forge.xxxxxx.org
api_url: http://forge:3000

#################################################
# Database Configuration                        #
#################################################

db:
  logging: false
  ## The database type: sqlite|postgres
  type: postgres
  ### SQLite options

  ## The database filename. Relative to $FLOWFORGE_HOME/var/
  ## Set to ':memory:' for a database that is wiped on restart
  # storage: forge.db

  ### Postgres options

  host: postgres
  user: forge
  password: secret

#################################################
# Project Driver Configuration                  #
#################################################

driver:
  ## The type of backend driver to use
  ##  Can be: localfs/docker/stub/k8s
  type: docker

  options:
    ## Options to be passed to the driver

    ### LocalFS options

    ## The first port number to assign to projects
    # start_port: 7880

    ## Path to find node executable if not on the default path
    # node_path: /usr/bin/node

    ### Docker options

    ## Docker socket path
    socket: /tmp/docker.sock
    # registry: hub.flowforge.com

    ### K8S options

    ## Kubectl conf file to contact the cluster
    # config_file: /opt/share/projects/flowforge/test/config
    # regsitry: hub.flowforge.com

broker:
  url: mqtt://flowforge-broker:1883
  public_url: wss://mqtt.xxxxxx.org

fileStore:
  url: http://file-server:3001

create_admin: true
hardillb commented 1 month ago

Ahhh,

How have you configured security for the HTTP end points for that instance in the FlowFuse Application?

image

Have you enabled FlowFuse User Authentication?

If so you will need to included a user security token in the header (Authorization: Bearer [token]) when making the request.

You can generate a user token under the security settings for your user

VINISHVV commented 1 month ago

@hardillb - Thank you. The issue is related to my limited knowledge; I have not added the token in my API request.