Error: API User Not Configured when calling logic core APIs

Hello,

When trying to write a logic function that uses the list devices core API I get the following error:

Error: Particle API user not configured
    at job (particle-internal:user-code:5:12)
    at particle-internal:main:20:7

Here is the source code for the function, with our product ID abstracted:

import Particle from 'particle:core';

export default function job({ functionInfo, trigger, scheduled }) {
  Particle.listDevices('<PRODUCT_ID>')
    .then((devices) => {
      console.log('Got Devices');
    })
    .catch((error) => {
      console.log(`Failed: ${error}`)
    })
    ;
}

I've tried a few of the other API calls and they all seem to fail the same.
How can I configure this function to be authenticated with an API user?

Where is your logic block located? I suspect that you probably need to create a logic block that interacts with a product either within the product, or within the organization.

If you create a logic block at the top level of your sandbox, it won't have any API user assigned, because API users are scoped to product or organization only, not sandbox.

@rickkas7 I am creating a logic block within a product and passing its product ID to the listDevices function.
I have tried this again with a new function in another product to confirm and it is still failing