Giter VIP home page Giter VIP logo

Comments (11)

fredriks avatar fredriks commented on September 25, 2024

Happy to! Never heard of it though so I'd appreciate any documentation references for how it is used and when it applies 😄

from cloud-functions-runtime-config.

joshunger avatar joshunger commented on September 25, 2024

Created a PR for the throwing a new error #9

from cloud-functions-runtime-config.

joshunger avatar joshunger commented on September 25, 2024

I guess GOOGLE_CLOUD_PROJECT is the new variable to be used and GCLOUD_PROJECT is being deprecated?

from cloud-functions-runtime-config.

joshunger avatar joshunger commented on September 25, 2024

See Jon Skeet's comment in googleapis/gax-dotnet#218

from cloud-functions-runtime-config.

fredriks avatar fredriks commented on September 25, 2024

In what context is this environment variable used? That seem to be the .NET extensions whereas this is nodejs. Is this value always available in the CF environment?

from cloud-functions-runtime-config.

joshunger avatar joshunger commented on September 25, 2024

Great question. Does this answer it -

https://github.com/GoogleCloudPlatform/cloud-functions-emulator/blob/master/src/utils/detectProjectId.js

Oddly, they favored GCLOUD_PROJECT over GOOGLE_CLOUD_PROJECT for some reason? Any ideas?

Here are the examples I was looking at for you -

https://github.com/search?l=JavaScript&q=org%3AGoogleCloudPlatform+GOOGLE_CLOUD_PROJECT&type=Code

from cloud-functions-runtime-config.

fredriks avatar fredriks commented on September 25, 2024

Interesting! Thanks for providing the references, I'll have a look!

from cloud-functions-runtime-config.

fredriks avatar fredriks commented on September 25, 2024

What was the context where you needed to provide the value and what error (if any) did you run into?

from cloud-functions-runtime-config.

joshunger avatar joshunger commented on September 25, 2024

Ah good question.

I never ran gcloud auth application-default login or glcoud init since I downloaded service account .json credentials.

So, when I ran your code it tried to use undefined in the URL.

You get this exception -

(node:40972) UnhandledPromiseRejectionWarning: Error: Permission denied on resource project undefined.
    at createError (webpack:////Users/junger/dev/pencilled/node_modules/axios/lib/core/createError.js?:16:15)
    at settle (webpack:////Users/junger/dev/pencilled/node_modules/axios/lib/core/settle.js?:18:12)
    at IncomingMessage.handleStreamEnd (webpack:////Users/junger/dev/pencilled/node_modules/axios/lib/adapters/http.js?:201:11)
    at IncomingMessage.emit (events.js:165:20)
    at endReadableNT (_stream_readable.js:1101:12)
    at process._tickCallback (internal/process/next_tick.js:152:19)
(node:40972) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 3)
(node:40972) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

from cloud-functions-runtime-config.

fredriks avatar fredriks commented on September 25, 2024

Perfect, thanks for this!

Seeing that the variable doesn't seem to be documented in any of the official Cloud Functions docs and that the backing libraries throw an exception anyway I'm inclined to not enforce it but rather add this info to the README as you suggest. Either a section for "How to run locally/outside GCP" or "Troubleshooting" for when the above error presents itself. A reminder to run gcloud auth application-default login, gcloud init or to set GCLOUD_PROJECT in cases where it is expected.

What do you think?

from cloud-functions-runtime-config.

joshunger avatar joshunger commented on September 25, 2024

Sounds good to me.

from cloud-functions-runtime-config.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.