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

Fields Compile Error :base64.decode_binary/5 #76

Closed
nelsonic opened this issue Sep 13, 2020 · 5 comments
Closed

Fields Compile Error :base64.decode_binary/5 #76

nelsonic opened this issue Sep 13, 2020 · 5 comments
Labels
chore help wanted Extra attention is needed technical

Comments

@nelsonic
Copy link
Member

Sadly, this compilation error has just appeared in auth on localhost ... 😕

==> fields
Compiling 23 files (.ex)

== Compilation error in file lib/aes.ex ==
** (FunctionClauseError) no function clause matching in :base64.decode_binary/5

    The following arguments were given to :base64.decode_binary/5:

        # 1
        ""

        # 2
        <<156, 199, 90, 201, 10, 81, 209, 170, 26, 176, 182, 170, 214, 15, 120, 20, 182, 218, 248, 15, 176, 7, 142, 9, 46, 74, 56, 238, 197, 80>>

        # 3
        23

        # 4
        12

        # 5
        32

    (stdlib 3.13.1) base64.erl:374: :base64.decode_binary/5
    (elixir 1.10.4) lib/enum.ex:1396: Enum."-map/2-lists^map/1-0-"/2
    lib/aes.ex:17: (module)
    (stdlib 3.13.1) erl_eval.erl:680: :erl_eval.do_apply/6
could not compile dependency :fields, "mix compile" failed. You can recompile this dependency with "mix deps.compile fields", update it with "mix deps.update fields" or clean it with "mix deps.clean fields"

Need to fix this to continue making progress on dwyl/auth#114 (comment)

@nelsonic nelsonic added help wanted Extra attention is needed chore technical labels Sep 13, 2020
@nelsonic
Copy link
Member Author

OK, it appears that the seeds.exs script may be to blame ...
Specifically re-writing the .env file:
https://github.com/dwyl/auth/blob/e9c63cd60aa8ec4bfc376c76313766cb265b9c6f/priv/repo/seeds.exs#L65-L99
So it looks like this is not an issue with fields or aes ...
When I created new ENCRYPTION_KEYS keys (environment variable), the mix deps.compile fields works:

==> fields
Compiling 23 files (.ex)
warning: @behaviour Ecto.Type does not exist (in module Fields.Password)
  lib/password.ex:1: Fields.Password (module)

warning: @behaviour Ecto.Type does not exist (in module Fields.PostcodeEncrypted)
  lib/postcode_encrypted.ex:1: Fields.PostcodeEncrypted (module)

warning: @behaviour Ecto.Type does not exist (in module Fields.Postcode)
  lib/postcode.ex:1: Fields.Postcode (module)

warning: @behaviour Ecto.Type does not exist (in module Fields.Url)
  lib/url.ex:1: Fields.Url (module)

warning: @behaviour Ecto.Type does not exist (in module Fields.PhoneNumberEncrypted)
  lib/phone_number_encrypted.ex:1: Fields.PhoneNumberEncrypted (module)

warning: @behaviour Ecto.Type does not exist (in module Fields.Name)
  lib/name.ex:1: Fields.Name (module)

warning: @behaviour Ecto.Type does not exist (in module Fields.PhoneNumber)
  lib/phone_number.ex:1: Fields.PhoneNumber (module)

warning: @behaviour Ecto.Type does not exist (in module Fields.UrlEncrypted)
  lib/url_encrypted.ex:1: Fields.UrlEncrypted (module)

warning: @behaviour Ecto.Type does not exist (in module Fields.IpAddressPlaintext)
  lib/ip_address_plaintext.ex:1: Fields.IpAddressPlaintext (module)

warning: @behaviour Ecto.Type does not exist (in module Fields.IpAddressHash)
  lib/ip_address_hash.ex:1: Fields.IpAddressHash (module)

warning: @behaviour Ecto.Type does not exist (in module Fields.IpAddressEncrypted)
  lib/ip_address_encrypted.ex:1: Fields.IpAddressEncrypted (module)

warning: @behaviour Ecto.Type does not exist (in module Fields.HtmlBody)
  lib/html-body.ex:1: Fields.HtmlBody (module)

warning: @behaviour Ecto.Type does not exist (in module Fields.Hash)
  lib/hash.ex:1: Fields.Hash (module)

warning: @behaviour Ecto.Type does not exist (in module Fields.EmailPlaintext)
  lib/email_plaintext.ex:1: Fields.EmailPlaintext (module)

warning: @behaviour Ecto.Type does not exist (in module Fields.Encrypted)
  lib/encrypted.ex:1: Fields.Encrypted (module)

warning: @behaviour Ecto.Type does not exist (in module Fields.EmailHash)
  lib/email_hash.ex:1: Fields.EmailHash (module)

warning: @behaviour Ecto.Type does not exist (in module Fields.Address)
  lib/address.ex:1: Fields.Address (module)

warning: @behaviour Ecto.Type does not exist (in module Fields.EmailEncrypted)
  lib/email_encrypted.ex:1: Fields.EmailEncrypted (module)

warning: @behaviour Ecto.Type does not exist (in module Fields.DescriptionPlaintextUnlimited)
  lib/description_plaintext_unlimited.ex:1: Fields.DescriptionPlaintextUnlimited (module)

warning: @behaviour Ecto.Type does not exist (in module Fields.AddressEncrypted)
  lib/address_encrypted.ex:1: Fields.AddressEncrypted (module)

warning: HtmlSanitizeEx.basic_html/1 is undefined (module HtmlSanitizeEx is not available or is yet to be defined)
  lib/html-body.ex:22: Fields.HtmlBody.dump/1

warning: HtmlSanitizeEx.strip_tags/1 is undefined (module HtmlSanitizeEx is not available or is yet to be defined)
  lib/description_plaintext_unlimited.ex:21: Fields.DescriptionPlaintextUnlimited.dump/1

warning: Argon2.gen_salt/0 is undefined (module Argon2 is not available or is yet to be defined)
  lib/helpers.ex:11: Fields.Helpers.hash/2

warning: Argon2.Base.hash_password/3 is undefined (module Argon2.Base is not available or is yet to be defined)
  lib/helpers.ex:11: Fields.Helpers.hash/2

Generated fields app

A few warnings we might want to examine ... 💭

@nelsonic
Copy link
Member Author

Most of these warnings are due to Ecto updating from using @behaviour Ecto.Type to use Ecto.Type https://hexdocs.pm/ecto/Ecto.Type.html gonna update this to avoid the warning(s).

@nelsonic
Copy link
Member Author

The Argon2 warning appears to be related to: riverrun/argon2_elixir#39
Going to update OTP version and see if that resolves it.

@nelsonic
Copy link
Member Author

Package published to https://hex.pm/packages/fields/2.7.1

@nelsonic
Copy link
Member Author

@iteles PR: #77 assigned to you. (Please/Thanks) 👍

iteles added a commit that referenced this issue Sep 13, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore help wanted Extra attention is needed technical
Projects
None yet
Development

No branches or pull requests

1 participant