MihaelIsaev / FCM

⚡️ PushNotifications through FireBase for Vapor 3 and 4.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Fatal error when running migrations on terminal.

loopingGIT opened this issue · comments

After I installed the package, now when trying to run my migrations I get this error:

Fatal error: FCM Unable to generate JWT: JWTKit error: signing algorithm error: signFailure: file 
/some_path/.build/checkouts/FCM/Sources/FCM/FCM.swift, line 72

If I comment out app.fcm.configuration = .envServiceAccountKey on the configure file, everything works.
This is just an issue when running migrations, the projects other than that works as expected.

Could you make a test project where I can reproduce that issue?

Or maybe it is happening because when you execute migrations it executes without environment variables? I just don't use Fluent so never tried to run their migrations unfortunately.

Will try to recreate it in a new project. I also found this vapor/jwt-kit: vapor/jwt-kit#26

To be honest don't know about the environment variable, will check.

Do you use .env file for environment variables in that project? With it I believe it should work with both terminal and Xcode (don't forget to set custom working directory).

Yes, I do use .env on this project, I have all my db connection info in there, so I guess is loaded just fine. I did set the working directory through xCode.

Ok then it's weird 🙂 would be great if you could make some test project where this bug is easily reproducible

I'm facing basically the same problem. It might be related to vapor/jwt-kit#26 and https://bugs.swift.org/browse/SR-12424.

@jstorm31 this is interesting, thank you for links

I managed to isolate and reproduce the error. Here's the repository. I get this error when running on CLI:

Fatal error: FCM Unable to generate JWT: JWTKit error: signing algorithm error: signFailure: file /Users/jstorm31/Dev/XCode/jwt-error-test/.build/checkouts/FCM/Sources/FCM/FCM.swift, line 72
[1]    94071 illegal hardware instruction  swift run

It might be really [the issues] I posted earlier. In that case, I guess there is no other option than wait for fixing it. What do you think @MihaelIsaev?

Is there any update on this? I've been seeing it on Xcode 12.5 and Swift 5.4. (with the same code that was working perfectly fine on a previous Xcode/Swift version)