Open maurocolella opened 1 year ago
Assigning to @getsentry/support for routing, due by (sfo). ⏲️
Routing to @getsentry/product-owners-sdks-web-frontend for triage, due by (vie). ⏲️
Hey, thanks for reporting this. We should probably add this to the example. FWIW I think the current version still applies and we should keep it.
I cannot add sentry profiling at all to my gen2, nodejs + Typescript endpoint at all because this is missing. There type error occurs when calling:
import { MessagePublishedData } from '@google/events/cloud/pubsub/v1/MessagePublishedData';
import {
cloudEvent,
CloudEventFunction,
} from '@google-cloud/functions-framework';
import { CloudEventV1 } from 'cloudevents';
const main: CloudEventFunction<MessagePublishedData> = async (
event: CloudEventV1<MessagePublishedData>,
) => {
// function here
};
cloudEvent<MessagePublishedData>(
'topicName',
Sentry.GCPFunction.wrapEventFunction(main),
);
The error is:
Argument of type 'EventFunctionWithCallback' is not assignable to parameter of type 'CloudEventFunction<MessagePublishedData>'.
Target signature provides too few arguments. Expected 3 or more, but got 1
Any help is greatly appreciated, because I can't use sentry in any of my cloud functions.
Hey @mattgraphlan if I'm not mistaken, this problem isn't related to the original issue. Would you mind opening a new one?
My suspicion is that GCP cloud function APIs have changed or new ones were added. However, our Serverless package is generally not up to date with these more recent developments as it isn't a major focus of support for us. If you have any ideas or solutions how to use Sentry with these new APIs, feel free to let us know. We're more than happy to review PRs!
Core or SDK?
Platform/SDK
Which part? Which one?
@sentry/serverless
Description
The documentation suggests this form to wrap CloudEvent-type Google Cloud Functions:
But this doesn't match the actual recommended shape of handlers:
As a result, types do not align. Code samples in git are also minimal.
Suggested Solution
Update the documentation to clearly indicate usage with the current API.