Skip to content

Typescript function source location can only be referenced from main field in package.json? #469

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
legendsjohn opened this issue Jul 13, 2022 · 2 comments
Assignees

Comments

@legendsjohn
Copy link

It seems like the --source flag in gcloud functions deploy can't be used with Typescript unless you copy over your package.json to the build output directory? This also seems to apply to the deploy cloud functions action.

This seems to be because the referenced source folder must also contain your package.json file. With Typescript, this is likely to be two different folders (ie. /build vs /).

Thus, the only way to reference the cloud function source is in main of package.json like https://github.com/GoogleCloudPlatform/functions-framework-nodejs/blob/master/docs/typescript.md describes.

I wanted to ensure this is expected behavior? If so, could the docs stress this? I spent a many hours figuring this out, as the cause of this problem wasn't immediately clear.

@legendsjohn
Copy link
Author

This may be a duplicate of #254, but I wanted to double check this understanding of the --source flag

matthewrobertson added a commit that referenced this issue Nov 18, 2022
This was very out of date. Updated to reflect most recent version of the
FF.

fixes #472, #469
matthewrobertson added a commit that referenced this issue Nov 19, 2022
This was very out of date. Updated to reflect most recent version of the
FF.

fixes #472, #469
matthewrobertson added a commit that referenced this issue Nov 19, 2022
This was very out of date. Updated to reflect most recent version of the
FF.

fixes #472, #469
@matthewrobertson
Copy link
Member

I updated the docs. You should configure the main field to point to your compiled source code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants