Sending response to client side

Hello everybody,

I’m creating a new extension for my app to read metadata from a Google Spreadsheet document.

Everything seems to be working yet I need the clientside to receive the response that is being displayed only on the serverside now.

const { google } = require('googleapis');


exports.spreadsheetGoogle = async function (options) {

    let response = {};

    const auth = new google.auth.GoogleAuth({
        keyFile: "./extensions/server_connect/modules/googleCredentials/credencialesSpreadsheet.json",
        scopes: "https://www.googleapis.com/auth/spreadsheets",
      });

    // Create client instance for auth
    const client = await auth.getClient();

    // Instance of Google Sheets API
    const googleSheets = google.sheets({
        version: "v4",
        auth: client
    });

    const spreadsheetId = "1ig4pGOX0Q0GHL5qcYNQbi9wpYwOMw_gsTwLFeDG9RPY";

    // Get metadata about spreadsheet
    const metaData = await googleSheets.spreadsheets.get({
        auth,
        spreadsheetId,
    });

    response.metaData = metaData;
    console.log(response);
    
    return response;

}

The return response is not working, I’m not getting the data on my browers, yet the server output shows the data correctly (with the console.log).

I’ve already created an extension myself and using response I could see the data on my clientside. Why I can’t do that now? I’m missing something.

Thanks!

Try to re-tick the Output checkbox of your module action step. I’ve experienced something similar yesterday, sounds like a Wappler bug

1 Like

I did that already. It’s still not showing the output data (the response).

Found the error. My hjson file was missing the name property

{ name: 'name', optionName: 'name', title: 'Name<sup style="color:red">*</sup>', type: 'text', required: true, defaultValue: ''},

When pasting code in your posts, please format it as explained here:

1 Like