Flows stopped due to missing node types (but node type is undefined)

Hi everyone, I'm new to node-red and java script in general
And I want to create my node that will take data, do some manipulations with this data and then send the data via http I use axios for requests
After many attempts I managed to install my node.
but now I hit a wall and I don't know what to do.
When I try to deploy I get an error Flows stopped due to missing node types but the thing is it doesn't say what nodes are missing instead it just blanks the field.
In the node itself I don't have the gui for node configuration displayed
I'm trying to figure out what the problem is either in my code or in the nodejs settings.

I would be grateful for your help
Thanks in advance to all who helped

my js code:

const axios = require("axios");

module.exports = function (RED) {
    function SimpleBuNode(config) {
        RED.nodes.createNode(this, config);

        // Retrieve node properties from the config
        this.endpointUrl = config.endpointUrl;
        this.sn = config.sn;
        this.type = config.type;
        this.isProd = config.isProd;

        // Function to handle the input messages
        this.on("input", function (msg, send, done) {
            // Check if the input is an array of objects or a single object
            const payload = Array.isArray(msg.payload) ? msg.payload : [msg.payload];

            // Prepare the data for the HTTP request
            const data = payload.map((obj) => ({
                timestamp: obj.timestamp,
                sensor: obj.sensor,
                value: obj.value,
            }));

            // Create the request payload
            const requestData = {
                dzType: this.type,
                dzSN: this.sn,
                data: data,
                isProd: this.isProd,
            };

            // Make the HTTP POST request using Axios
            axios
                .post(this.endpointUrl, requestData)
                .then((response) => {
                    // Do something with the response if needed
                    // For example, log the response
                    this.log("Received response: " + JSON.stringify(response.data));

                    // Send the output message with the response data
                    msg.payload = response.data;
                    send(msg);
                    done();
                })
                .catch((error) => {
                    // Handle the error if the request fails
                    this.error("Failed to make HTTP request: " + error.message);
                    done(error);
                });
        });
    }

    RED.nodes.registerType("simple-bu", SimpleBuNode);
};


my html code:

<script type="text/javascript">
    // Define the configuration panel
    RED.nodes.registerType('simple-bu', {
      category: 'config',
      color: '#a6bbcf',
      defaults: {
        endpointUrl: { value: "", required: true },
        sn: { value: "", required: true },
        type: { value: "", required: true },
        mode: { value: "test", required: true },
      },
      inputs: 1,
      outputs: 1,
      icon: "node-red-contrib-simple-bu.png",
      label: function () {
        return this.name || 'simple-bu';
      },
      oneditprepare: function () {
        $("#node-input-mode").on("change", function () {
          if (this.value === "test") {
            $("#node-simple-bu-endpointUrl-row").show();
            $("#node-simple-bu-sn-row").show();
            $("#node-simple-bu-type-row").show();
          } else {
            $("#node-simple-bu-endpointUrl-row").hide();
            $("#node-simple-bu-sn-row").hide();
            $("#node-simple-bu-type-row").hide();
          }
        });
      },
      oneditsave: function () {
        var mode = $("#node-input-mode").val();
        if (mode === "prod") {
          // Clear fields for prod mode to avoid sending sensitive data
          $("#node-input-endpointUrl").val("");
          $("#node-input-sn").val("");
          $("#node-input-type").val("");
        }
      },
    });
  </script>
  <style>
    /* Add any custom CSS styles for the configuration panel here */
    /* For example, to hide rows based on the mode */
    #node-simple-bu-endpointUrl-row,
    #node-simple-bu-sn-row,
    #node-simple-bu-type-row {
      display: none;
    }
  </style>
  <div class="form-row">
    <label for="node-input-mode"><i class="icon-tag"></i> Mode</label>
    <select id="node-input-mode">
      <option value="test" selected>Test</option>
      <option value="prod">Prod</option>
    </select>
  </div>
  <div class="form-row" id="node-simple-bu-endpointUrl-row">
    <label for="node-input-endpointUrl"><i class="icon-link"></i> Endpoint URL</label>
    <input type="text" id="node-input-endpointUrl" placeholder="Endpoint URL">
  </div>
  <div class="form-row" id="node-simple-bu-sn-row">
    <label for="node-input-sn"><i class="icon-tag"></i> SN</label>
    <input type="text" id="node-input-sn" placeholder="SN">
  </div>
  <div class="form-row" id="node-simple-bu-type-row">
    <label for="node-input-type"><i class="icon-tag"></i> Type</label>
    <input type="text" id="node-input-type" placeholder="Type">
  </div>
  

Hello @mngkkkkkk!
Welcome to this community!

Most probably you've an error in either the server side or the client side code of your (custom) node.
Just check the console of your browser or the console output of the NR server if there're some issues reported.

If that really is your code, you are missing important parts - like <script type="text/html" data-template-name="node-type"> for your form elements

Its listed in the docs and there are around 4500 nodes on NPM you can look at for inspiration.

Good luck :crossed_fingers:

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.