Use Fundebug API bulk upload Source Map

Abstract: Upload Source Map through code batch, automate processes!

Fundebug support the use of Source Map restore the true error position . In this case, developers can quickly locate the source of error. In addition, Fundebug also able to display the error code blocks to help developers solve problems faster.

What uploads Fundebug Source Map support?

If you want to use the Source Map function, we have to get the Source Map file. Users can mount Source Map files to your server, we will automatically download; Alternatively, the user can take the initiative to upload Source Map. We provided a total of 3 different ways to upload:

  • Front-end UI upload
  • fundebug-cli bulk upload
  • API upload

The first two ways are more intuitive, document in detail below. Took over how to achieve bulk upload Source Map API calls through the code.

How to bulk upload Source Map?

Fundebug support by POSTrequesting upload Source Map, interfaces /javascript/sourcemap/upload, parameters include

  • apikey: Get apikey need to register free account and create a project.
  • appversion: Optional, used to configure the application version. If you want to distinguish between different versions of Source Map, at the time of access Fundebug, appversion corresponding attributes must be configured, and updated when the code updates.
  • sourceMap: Source Map file information, please refer to the specific content of the sample code below.

Node.js version of the code is given below for reference,

const request = require("request-promise");
const fs = require("fs");

const options = {
    method: "POST",
    uri: "https://fundebug.com/javascript/sourcemap/upload",
    formData: {
        apikey: "YOUR-API-KEY",
        appversion: "1.0.0",
        sourceMap: {
            value: fs.createReadStream("./data/app.6c20067a.js.map"),
            options: {
                filename: "app.6c20067a.js.map",
                contentType: "text"
            }
        }
    }
};

request(options)
    .then(function(success) {
        console.log("success:", success);
    })
    .catch(function(err) {
        console.log("fail:", err);
    });

How to remove uploaded Source Map?

If Source Map upload too much, and I hope the old Source Map file deleted, we also provide the appropriate interface: /javascript/sourcemap/clear. Sample code is as follows:

const request = require("request-promise");
const fs = require("fs");

const options = {
    method: "POST",
    uri: "https://fundebug.com/javascript/sourcemap/clear",
    body: {
        apikey: "YOUR-API-KEY"
    },
    json: true
};

request(options)
    .then(function(success) {
        console.log("success:", success);
    })
    .catch(function(err) {
        console.log("fail:", err);
    });

Customer feedback thanks to a large gale change of technology!

About Fundebug

Fundebug focus on JavaScript, applets micro-channel, micro-channel games, Alipay small program, React Native, Node.js and Java applications in real-time online monitoring BUG. Since 2016, two-eleven formally launched, Fundebug handled a total of 3 billion + error event, paying customers have Sunshine Insurance, Darling home, walnuts programming, lychee FM, micro veins and many other brands. Welcome to Free Trial !

Guess you like

Origin www.cnblogs.com/fundebug/p/fundebug-support-upload-clear-sorcemap-by-api.html