Skip to content

CloudFunctionsContext no longer exported? #216

Closed
@techieshark

Description

@techieshark

I had working code as below on [email protected]:

import { CloudFunctionsContext } from '@google-cloud/functions-framework';
import { Message } from '@google-cloud/pubsub';

/**
 * A cloud function triggered by a PubSub message.
 * @see https://cloud.google.com/functions/docs/writing/background#function_parameters
 */
exports.pubsub = async function pubsub(
  pubsubMessage: Message,
  context: CloudFunctionsContext
) {
...

after updating to latest (1.7.1), I got TS error on first line:

Module '"../node_modules/@google-cloud/functions-framework/build/src/invoker"' has no exported member 'CloudFunctionsContext'.ts(2305)

I resolved this by changing the line to

import { CloudFunctionsContext } from '@google-cloud/functions-framework/build/src/functions';

but it suggests a couple questions:

  1. Was I (and am I know) using the types as intended, and
  2. Was this an intentional change (I did see some refactors mentioned in the release log), or should CloudFunctionsContext still be exported from the top level?

Thanks!

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions