Skip to content

panic: Failed to create sublogger (smtp): json: cannot unmarshal string into Go struct field SMTPLogger.sendTos of type []string  #9151

@ArchangeGabriel

Description

@ArchangeGabriel
  • Gitea version (or commit ref): 1.10.0
  • Operating system: ArchLinux
  • Can you reproduce the bug at https://try.gitea.io:
    • Yes (provide example URL)
      No
      Not relevant
  • Log gist:

Description

When setting an smtp logger, I get this:

panic: Failed to create sublogger (smtp): json: cannot unmarshal string into Go struct field SMTPLogger.sendTos of type []string 
goroutine 1 [running]:
code.gitea.io/gitea/modules/log.NewLogger(0x2710, 0xc0007c13d0, 0x4, 0xc0007c13d0, 0x4, 0xc0004be600, 0xff, 0xc0007abf00)
        code.gitea.io/gitea@/modules/log/log.go:48 +0x1b3
code.gitea.io/gitea/modules/setting.newLogService()
        code.gitea.io/gitea@/modules/setting/log.go:263 +0x7a0
code.gitea.io/gitea/modules/setting.NewLogServices(0xc00182e200)
        code.gitea.io/gitea@/modules/setting/log.go:282 +0x24
code.gitea.io/gitea/modules/setting.NewServices()
        code.gitea.io/gitea@/modules/setting/setting.go:1047 +0x32
code.gitea.io/gitea/routers.NewServices()
        code.gitea.io/gitea@/routers/init.go:44 +0x24
code.gitea.io/gitea/routers.GlobalInit()
        code.gitea.io/gitea@/routers/init.go:79 +0x358
code.gitea.io/gitea/cmd.runWeb(0xc0000f0dc0, 0x0, 0x0)
        code.gitea.io/gitea@/cmd/web.go:108 +0x75
github.com/urfave/cli.HandleAction(0xdf2e200c080, 0xdf2e22a1010, 0xc0000f0dc0, 0xc0000cf300, 0x0)
        github.com/urfave/cli@v1.20.0/app.go:490 +0xca
github.com/urfave/cli.Command.Run(0xdf2df180dcf, 0x3, 0x0, 0x0, 0x0, 0x0, 0x0, 0xdf2df1afbf8, 0x16, 0x0, ...)
        github.com/urfave/cli@v1.20.0/command.go:210 +0x993
github.com/urfave/cli.(*App).Run(0xc0000b9040, 0xc0000d0000, 0x4, 0x4, 0x0, 0x0)
        github.com/urfave/cli@v1.20.0/app.go:255 +0x6ad
main.main()
        code.gitea.io/gitea@/main.go:109 +0x818

Under [log.smtp], I’m only doing this:

-HOST =
+HOST = 127.0.0.1:25
-RECEIVERS =
+RECEIVERS = someuser@somedomain.com

Activity

zeripath

zeripath commented on Nov 25, 2019

@zeripath
Contributor

Try:

RECEIVERS = [someuser@somedomain.com]
ArchangeGabriel

ArchangeGabriel commented on Nov 25, 2019

@ArchangeGabriel
Author

Doesn’t work either.

zeripath

zeripath commented on Nov 25, 2019

@zeripath
Contributor

Damn, I think this should work:

RECEIVERS = ["someuser@somedomain.com"]

(Clearly this is not ideal UI, we should be splitting the strings ourselves, but I'm trying to get this to work first before we have to put out a bugfix)


Nope that doesn't work either.

added a commit that references this issue on Nov 25, 2019
4d83fb9
zeripath

zeripath commented on Nov 25, 2019

@zeripath
Contributor

Sorry about this. Clearly you're the first person to try this and I missed it when I was writing the code!

I do apologise.

ArchangeGabriel

ArchangeGabriel commented on Nov 25, 2019

@ArchangeGabriel
Author

That’s OK. ;) Bugs happen, the important thing is to fix them. :)

I’ll try your PR when I’ll have time to build a patched version (i.e. at least not today).

added a commit that references this issue on Nov 25, 2019
f5bd088
added this to the 1.10.1 milestone on Nov 25, 2019
added a commit that references this issue on Nov 25, 2019
65053d6
added a commit that references this issue on Nov 25, 2019
2b257a9
ArchangeGabriel

ArchangeGabriel commented on Jan 3, 2020

@ArchangeGabriel
Author

I can confirm this now works correctly (well at least it does not crash, did not received an email yet). :)

added a commit that references this issue on Jan 23, 2020
181b68d
locked and limited conversation to collaborators on Nov 24, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

      Development

      Participants

      @lunny@ArchangeGabriel@zeripath

      Issue actions

        panic: Failed to create sublogger (smtp): json: cannot unmarshal string into Go struct field SMTPLogger.sendTos of type []string · Issue #9151 · go-gitea/gitea