meteor / meteor

Meteor, the JavaScript App Platform

Home Page:https://meteor.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Meteor 3] Server-only Method displays "Method stub took too long" warning in browser console when using Meteor.callAsync

jamauro opened this issue · comments

Version: Meteor 3.0-beta.0

I have a server-only Method that I'm calling, i.e. it has no stub, but I'm seeing this warning in the browser console when I use Meteor.callAsync. If I use Meteor.applyAsync, I don't see the warning.

[Warning] Method stub (updateLink) took too long and could cause unexpected problems. Learn more at https://github.com/zodern/fix-async-stubs/#limitations (ddp-client.js, line 245)

Expected: I shouldn't see a stub warning if the Method doesn't have a stub. Also I don't think I should see this warning even if it were stubbed.

Here's the Method on the server:

// /server/main.js
import { Links } from '/imports/api/links';

const updateLink = async () => {
  const { _id } = await Links.findOneAsync() || {};
  return Links.updateAsync({ _id }, { $set: { title: 'hello' }});
};

Meteor.methods({ updateLink })
// on the client

const updateLink = async () => {
  try {
    await Meteor.callAsync('updateLink');
  } catch (error) {
    console.error(error)
  }
};

This is going to be fixed here, #13055

@nachocodoner can this now be closed?

Yes, it is fixed and included on the next beta. Ty