firebase / firebase/functions-samples

[BUG] in sample: stripe (FUNCTION_NAME)

Open
#909 0 comments 0 reactions 0 assignees View on GitHub
type: bug
Dominant language
JavaScript
Stars
12.2k
Forks
3.8k
Avg merge
3d 23h
Merged PRs (30d)
1

Description

### Which sample has a bug?

[Create Stripe customers and charge them on Firestore write](https://github.com/firebase/functions-samples/tree/main/stripe)

### How to reproduce the issue

1. Deploy code with node runtime later than node 8
2. Execute code in a manner that will log an error
3. Observe that "FUNCTION_NAME" will be undefined

Why? Because once cloud functions moved beyond Node 8, the environment variables that are exposed changed. This should now be `FUNCTION_TARGET` as defined here: https://cloud.google.com/functions/docs/configuring/env-var#newer_runtimes

### Debug output

**Screenshots**

![image](https://user-images.githubusercontent.com/772290/132415131-b26172f0-1bdc-4af0-a5d5-902b96440b86.png)

### Expected behavior

Expect the cloud function name to be shown, but `FUNCTION_NAME` is not a valid env var after node 8.

### Actual behavior

The name of the cloud function is `undefined`

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.