mirror of
https://github.com/marcogll/formbricks_form_manager.git
synced 2026-01-13 13:25:17 +00:00
feat: Add Formbricks API connection test script and debug logging for survey fetches.
This commit is contained in:
30
test-connection.js
Normal file
30
test-connection.js
Normal file
@@ -0,0 +1,30 @@
|
||||
const axios = require("axios");
|
||||
require("dotenv").config();
|
||||
|
||||
const url = `${process.env.FORMBRICKS_SDK_URL}/api/v1/management/surveys`;
|
||||
console.log(`Testing connection to: ${url}`);
|
||||
|
||||
axios
|
||||
.get(url, {
|
||||
headers: {
|
||||
"x-api-key": process.env.FORMBRICKS_API_KEY,
|
||||
},
|
||||
timeout: 15000,
|
||||
})
|
||||
.then((response) => {
|
||||
console.log("Success!");
|
||||
console.log("Status:", response.status);
|
||||
console.log(
|
||||
"Data length:",
|
||||
Array.isArray(response.data?.data)
|
||||
? response.data.data.length
|
||||
: "Not an array"
|
||||
);
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Error:", error.message);
|
||||
if (error.code) console.error("Code:", error.code);
|
||||
if (error.response) {
|
||||
console.error("Response Status:", error.response.status);
|
||||
}
|
||||
});
|
||||
Reference in New Issue
Block a user