[Solved]: Is the mikkelking:slingshot package Meteor 3.x compatible?

@mikkelking - is the package Meteor 3.x compatible?

We’ve just updated our app to Meteor 3.1.2 and while everything is working fine I’m now getting an error from within the package that I didn’t get before:

message: Match error: Expected object, got undefined
stack:    Error: Match error: Expected object, got undefined
    at format (packages/check/match.js:11:15)
    at check (packages/check/match.js:53:13)
    at Object.applySignature (packages/mikkelking:slingshot/services/aws-s3.js:285:7)
    at Object.upload (packages/mikkelking:slingshot/services/aws-s3.js:143:10)
    at Slingshot.Directive.getInstructions (packages/mikkelking:slingshot/lib/directive.js:152:46)
    at MethodInvocation.slingshot/uploadRequest (packages/mikkelking:slingshot/lib/directive.js:234:22)
    at packages/montiapm:agent/lib/hijack/wrap_session.js:208:57
    at AwaitDetector.detect (/home/zcloud/app/programs/server/npm/node_modules/meteor/montiapm_agent/node_modules/@monti-apm/core/src/await-detector.ts:105:14)
    at MethodInvocation.methodMap.<computed> (packages/montiapm:agent/lib/hijack/wrap_session.js:208:28)
    at maybeAuditArgumentChecks (packages/ddp-server/livedata_server.js:1748:12)
    at packages/ddp-server/livedata_server.js:601:19
    at AsyncLocalStorage.run (node:internal/async_local_storage/async_hooks:91:14)
    at EnvironmentVariableAsync.withValue (packages/meteor.js:1431:29)
    at packages/ddp-server/livedata_server.js:599:46
    at AsyncLocalStorage.run (node:internal/async_local_storage/async_hooks:91:14)
    at EnvironmentVariableAsync.withValue (packages/meteor.js:1431:29)

This is the relevant code where it breaks

Can anyone help, it’s quite essential to our app.

Thanks in advance,

Andreas

UPDATE: it was indeed a problem caused by our update to Meteor 3.x - we have forked the app and fixed it. It can be found under ferjep:slingshot

Just one thing to consider, the documentation of mikkelking:slingshot shows a dependency on underscore. Perhaps it would be best to de-underscore the package since you got your own version (if it is still dependent on that package) otherwise just to make sure underscore is not imported/required on the client.

I see this code at slingshot/lib/upload.js

Meteor.call("slingshot/uploadRequest", directive,
  file, metaData, function (error, instructions) {
  status.set(error ? "failed" : "authorized");
  callback(error, instructions);
});

So at the very least there’s some Meteor.call that needs to be updated to Meteor.callAsync with try/catch.

There are lots of forks so I’m sure someone has updated it. We’ll be integrating it shortly so I’ll report back here with what we end up using.

Thanks for the recommendation, will add that to our todo list. Make sense as we just got rid of _underscore in our Meteor code.

I stand corrected, just tried our forked version of slingshot (which is https://github.com/Sergeant61/meteor-slingshot - it had a few compatibility commits added to it) in our Meteor 3.3 upgrade and it works just fine.

Even with a the above Meteor.call in the code. Will have dig in to see if that particular one usage of Meteor.call is not being run. But it’s successfully uploading images.

Another correction, it looks like Meteor.call is still fair game in the docs if it doesn’t ever call anything async. Upon reviewing the Slingshot code, it looks like slingshot/uploadRequest just does a bunch of synchronous stuff, so that’s likely why it’s working fine.