GeezerVison is showing github.com — Failed to deploy - FileNotFoundException · Issue #3275 · googleapis/google-cloud-java
Failed to deploy - FileNotFoundException #3275DescriptionExpected
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

Build Config

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
Activityadam-hurwitz commented on 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 commented on May 16, 2018 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 commented on May 16, 2018 on second look I see a couple potential issues:
-
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).
-
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.
-
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 commented on 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?


etanshaul commented on May 18, 2018 @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 commented on May 19, 2018 @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 commented on May 24, 2018 The firebase billing thing is outside of the scope of my knowledge - sorry! chingor13 commented on Dec 5, 2018
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|