FCM icon indicating copy to clipboard operation
FCM copied to clipboard

Fatal error when running migrations on terminal.

Open loopingGIT opened this issue 4 years ago • 10 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.

loopingGIT avatar Jun 16 '20 13:06 loopingGIT

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

MihaelIsaev avatar Jun 16 '20 13:06 MihaelIsaev

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.

MihaelIsaev avatar Jun 16 '20 13:06 MihaelIsaev

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

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

loopingGIT avatar Jun 16 '20 13:06 loopingGIT

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).

MihaelIsaev avatar Jun 16 '20 13:06 MihaelIsaev

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.

loopingGIT avatar Jun 16 '20 13:06 loopingGIT

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

MihaelIsaev avatar Jun 16 '20 13:06 MihaelIsaev

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

jstorm31 avatar Jul 23 '20 16:07 jstorm31

@jstorm31 this is interesting, thank you for links

MihaelIsaev avatar Jul 23 '20 16:07 MihaelIsaev

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?

jstorm31 avatar Jul 23 '20 17:07 jstorm31

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)

LorDisturbia avatar Jul 05 '21 07:07 LorDisturbia

Seems fixed with https://github.com/vapor/jwt-kit/issues/26 and https://bugs.swift.org/browse/SR-12424.

MihaelIsaev avatar Mar 18 '24 16:03 MihaelIsaev