Discovering your custom fields - Solved

Question:
How do you discover your custom fields? Specifically the key value pairs to be able to use in updating a member.

Product:
Wix Editor

What are you trying to achieve:
I am trying to discover the custom fields of my member profiles.

What have you already tried:
From the docs: Custom Fields - Velo API Reference - Wix.com.
Using the code provided at the link above:
import { contacts } from ‘wix-crm-backend’;

export async function listCustomFieldKeys() {
const queryResults = await contacts.queryExtendedFields().find();
// Filters for custom fields (where fieldType is USER_DEFINED), then converts to an array of keys
return queryResults.items
.filter(field => field.fieldType === ‘USER_DEFINED’)
.map(field => field.key);
}

Additional information:
The above code is not working. Every time I run it from the front it results in the following error: “Failed to fetch custom field keys Error: Error: Unable to handle the request. Contact the site administrator or view site monitoring logs for more information. at Object.”

SOLVED: had to add suppress auth to the code and it finally worked.
import { contacts } from ‘wix-crm-backend’;

export async function listCustomFieldKeys() {
const queryResults = await contacts.queryExtendedFields().find({ suppressAuth: true });
// Filters for custom fields (where fieldType is USER_DEFINED), then converts to an array of keys
console.log("query results: ", queryResults)
return queryResults.items
.filter(field => field.fieldType === ‘USER_DEFINED’)
.map(field => field.key);
}