Netlify Functions

Hi there!

I’m using Netlify functions and square api to fetch data.
listCatalog() works just fine, but when I pass an argument (listCatalog(“ITEM”)), I get a 500 status code error.

Here’s my Netlify function:

const square = require(‘square’)

const handler = async (event) => {
const client = new square.Client({
timeout: 3000,
environment: square.Environment.Sandbox,
accessToken: process.env.SQUARE_ACCESS_TOKEN
})

try {
const response = await client.catalogApi.listCatalog(“ITEM”)
console.log(response.result)
return {
statusCode: 200
}

} catch (error) {
return { statusCode: 500, body: error.toString() }
}
}

module.exports = { handler }

What is your application Id and when did you getting this error?

Sandbox Application ID: sandbox-sq0idb-eLp46YF3pJLjjyaDe6GAfw

Tested it yesterday.