Testing - Shopify Functions works locally via function runner but not on dev store

Have a Shopify app - with 3 extensions (shopify functions).

When testing on dev store the output is always empty, but if I use the same input (grabbed from partner extension logs) and test it locally via the function runner (https://shopify.dev/docs/apps/build/functions/test-debug-functions#test-a-function-using-the-function-runner) it returns the expected output.

Just trying to hide a payment method for customer’s that have a specific metafield value:

Here is the Input query:

query RunInput {
  cart {
    buyerIdentity {
      customer {
        metafield(key: "payment_terms", namespace: "company") {
          value
        }
      }
    }
  }
  paymentMethods {
    id
    name
  }
}

example response would be:

{
  "cart": {
    "buyerIdentity": {
      "customer": {
        "metafield": {
          "value": "Terms 30"
        }
      }
    }
  },
  "paymentMethods": [
    {
      "id": "gid://shopify/PaymentCustomizationPaymentMethod/0",
      "name": "Deferred"
    },
    {
      "id": "gid://shopify/PaymentCustomizationPaymentMethod/1",
      "name": "(for testing) Bogus Gateway"
    },
    {
      "id": "gid://shopify/PaymentCustomizationPaymentMethod/2",
      "name": "Invoice"
    }
  ]
}

and the function is

// -check

/**
 * @typedef {import("../generated/api").RunInput} RunInput
 * @typedef {import("../generated/api").FunctionRunResult} FunctionRunResult
 * @typedef {import("../generated/api").Operation} Operation
 */

/**
 *  {FunctionRunResult}
 */
const NO_CHANGES = {
  operations: [],
};

/**
 * @param {RunInput} input
 * @returns {FunctionRunResult}
 */
export function run(input) {
  const payment_terms = input?.cart?.buyerIdentity?.customer?.metafield?.value;

  if (payment_terms === undefined) {
    console.error('Metafield is missing.');
    return NO_CHANGES;
  }

  let hidePaymentMethod = null;
  if (payment_terms.toUpperCase() === 'PREPAID') {
    // prepaid - hide invoice
    hidePaymentMethod = input.paymentMethods.find((method) =>
      method.name.includes('Invoice')
    );
  } else {
    // terms - hide credit card
    hidePaymentMethod = input.paymentMethods.find((method) =>
      method.name.includes('(for testing) Bogus Gateway')
    );
  }

  if (!hidePaymentMethod) {
    return NO_CHANGES;
  }

  return {
    operations: [
      {
        hide: {
          paymentMethodId: hidePaymentMethod.id,
        },
      },
    ],
  };
}

expected output is:

{
  "operations": [
    {
      "hide": {
        "paymentMethodId": "gid://shopify/PaymentCustomizationPaymentMethod/1"
      }
    }
  ]
}

which is what the function runner (local testing) returns, but when looking in partner dashboard logs :

{
  "operations": []
}

i also can’t seem to output to stderr either on development store via console.error, but this is working locally.

Thanks,
Kele

okay the functions are now running correctly on the development store, we didn’t change anything so not sure how it got resolved, but at least we’re now seeing consistency between the development store and the local function runner.

HOWEVER, now when we install it on a live staging store, it doesn’t seem like the function is running. And since there’s no logs avail on production stores we can’t tell what’s happening. Sharing logs back to developer (us) doesn’t seem to do anything, so it seems like there are actually no logs to even share.

Not sure if anyones had any issues with getting a app with shopify functions running properly. All we’ve done is install via link into our store.

Thanks,
Kele.