Skip to content
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

Failed to deploy - FileNotFoundException #3275

Closed
adam-hurwitz opened this issue May 16, 2018 · 8 comments
Closed

Failed to deploy - FileNotFoundException #3275

adam-hurwitz opened this issue May 16, 2018 · 8 comments
Assignees
Labels
auth running on app engine type: question Request for information or clarification. Not an issue.

Comments

@adam-hurwitz
Copy link

adam-hurwitz commented May 16, 2018

Expected

JAR deployment to AppEngine instance for Kotlin app.

Actual

During deployment to my AppEngine instance I am receiving the following FileNotFoundException. This error is not logical because the same built JAR runs the app successfully via IntelliJ prior to the deploy attempt.

Here is the Kotlin app file hierarchy which runs as expected both as an IntelliJ Application and JAR configuration. The "missing" directory/file is firebase/carpecoin-service-firebase-adminsdk-cyl9p-4b18763dbc.json which is nested under the main directory. The hierarchy was not altered after creating and building my JAR.

App Hiearchy
screen shot 2018-05-15 at 11 06 43 pm

Build Config
screen shot 2018-05-15 at 11 35 24 pm

Error

	at java.io.FileInputStream.open0(Native Method)
	at java.io.FileInputStream.open(FileInputStream.java:195)
	at java.io.FileInputStream.<init>(FileInputStream.java:138)
	at java.io.FileInputStream.<init>(FileInputStream.java:93)
	at Coordinator.main(Coordinator.kt:12)`
`Failed to deploy '[2018-05-15 23:00:21] carpe.coin_main.jar. Project: carpecoin-service. Version: auto': Deployment failed with exit code: 1```

## IntelliJ Info
IntelliJ IDEA 2018.1.3 (Community Edition)
Build #IC-181.4892.42, built on May 7, 2018
JRE: 1.8.0_152-release-1136-b38 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.10.5

@adam-hurwitz
Copy link
Author

adam-hurwitz commented May 16, 2018

I just ran the command gcloud components update and upgraded to the following:

Google Cloud SDK 201.0.0
app-engine-java 1.9.63
app-engine-python 1.9.69
bq 2.0.33
core 2018.05.11
gsutil 4.31

I attempted redeploying the same AppEngine build configuration but received the same error output.

@etanshaul
Copy link

thanks for details @AdamSHurwitz

in that error, could you possibly paste in all the way up the stack? It looks like you provided only the end. I'm wondering if there is anything there that can help us debug.

@etanshaul
Copy link

etanshaul commented May 16, 2018

on second look I see a couple potential issues:

  1. Not directly related to your issue, but you probably don't want to be storing you service account key on your source tree (and definitely don't want to be checking it in to version control alongside your source).

  2. You are loading the key as a file with a relative path and relying on the working directory, which can be unreliable. Better to load as a classpath resource.

  3. better yet, since you are running on app engine, use the default app engine credentials (no need to supply a service account key). See https://github.com/GoogleCloudPlatform/google-cloud-java#authentication. And when running locally, configure a GOOGLE_APPLICATION_CREDENTIALS environment variable to point to your service account key

@adam-hurwitz
Copy link
Author

adam-hurwitz commented May 17, 2018

The default app engine credentials worked. My app is deployed and running so a BIG thank you @etanshaul !!!

I believe this is the credential type you are referring to under the Firebase documentation
Add the Firebase Admin SDK to Your Server

The Admin SDKs can alternatively be authenticated with a different credential type. For example, if you are running your code within Google Cloud Platform, you can make use of Google Application Default Credentials to have the Admin SDKs themselves fetch a service account on your behalf.

FirebaseOptions options = new FirebaseOptions.Builder() .setCredentials(GoogleCredentials.getApplicationDefault()) .setDatabaseUrl("https://<DATABASE_NAME>.firebaseio.com/") .build(); FirebaseApp.initializeApp(options);

My question with this implementation is am I supposed to save the code above to version control? How do I ensure anyone with this code cannot access my Firebase database?

New Issue
I uncovered another related issue. When attempting to start a new Firebase project that is linked to a Google Cloud Project I received an error. I've attempted with both GCP Billing enabled and disabled. Where should I file this?

add a project

screen shot 2018-05-16 at 9 25 52 pm

@etanshaul
Copy link

@AdamSHurwitz I'm glad using the default credentials worked for you.

My question with this implementation is am I supposed to save the code above to version control? How do I ensure anyone with this code cannot access my Firebase database?

Yes. That auth code can live in your vcs. Presumably you needed to authenticate in order to deploy your app in the first place to your GCP account. Only apps running on your account should have access via your application default credentials. Maybe I misunderstood the concern?

Regarding the Firebase billing concern, I'll defer to @garrettjonesgoogle to please help with routing the question as I don't have all the relevant information on this.

@adam-hurwitz
Copy link
Author

@etanshaul - My concern is if I shared my GitHub repository publicly someone would be able to run the authentication portion of code in order to interact with my Firebase database.

Thank you for directing my Firebase/GCP project linking bug to @garrettjonesgoogle.

@garrettjonesgoogle
Copy link
Member

The firebase billing thing is outside of the scope of my knowledge - sorry!

@JustinBeckwith JustinBeckwith added 🚨 This issue needs some love. triage me I really want to be triaged. labels Jun 8, 2018
@yihanzhen yihanzhen added type: question Request for information or clarification. Not an issue. auth api: app engine priority: p2 Moderately-important priority. Fix may not be included in next release. and removed triage me I really want to be triaged. labels Jun 11, 2018
@JustinBeckwith JustinBeckwith removed the 🚨 This issue needs some love. label Jun 11, 2018
@JustinBeckwith JustinBeckwith added the 🚨 This issue needs some love. label Nov 12, 2018
@sduskis sduskis removed 🚨 This issue needs some love. priority: p2 Moderately-important priority. Fix may not be included in next release. labels Dec 3, 2018
@chingor13
Copy link
Contributor

For the firebase billing error, that should be filed with Firebase: https://firebase.google.com/support/contact/

The original issue appears to have been answered. Feel free to reopen if this is not the case.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth running on app engine type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

7 participants