Error deploying Shiny apps with leaflet and sf

I'm having trouble deploying Shiny apps whenever the code includes library(leaflet) or library(sf). Here's a minimal example:

library(sf) # Or: library(leaflet)
library(shiny)
ui <- fluidPage("Hello")
server <- function(input, output, session) { }
shinyApp(ui, server)

The error message:

Preparing to deploy application...DONE
Uploading bundle for application: 3845963...DONE
Deploying bundle: 4390881 for application: 3845963 ...
Waiting for task: 897061864
  building: Parsing manifest
################################ Begin Task Log ################################ 
################################# End Task Log ################################# 
Error: Unhandled Exception: Child Task 897061876 error: Unhandled Exception: 'NoneType' object has no attribute 'lower'
Execution halted

I tried installing older versions of the packages, but that did not help either. Here's the output of packageDescription():

> packageDescription("leaflet")
Package: leaflet
Type: Package
Title: Create Interactive Web Maps with the JavaScript 'Leaflet' Library
Version: 2.0.4.1
Authors@R: c( person("Joe", "Cheng", email = "joe@rstudio.com", role =
        c("aut", "cre")), person("Bhaskar", "Karambelkar", role = c("aut")),
        person("Yihui", "Xie", role = c("aut")), person("Hadley", "Wickham",
        role = c("ctb")), person("Kenton", "Russell", role = c("ctb")),
        person("Kent", "Johnson", role = c("ctb")), person("Barret",
        "Schloerke", role = c("ctb")), person("jQuery Foundation and
        contributors", role = c("ctb", "cph"), comment = "jQuery library"),
        person("Vladimir", "Agafonkin", role = c("ctb", "cph"), comment =
        "Leaflet library"), person("CloudMade", role = c("cph"), comment =
        "Leaflet library"), person("Leaflet contributors", role = c("ctb"),
        comment = "Leaflet library"), person("Brandon Copeland", role =
        c("ctb", "cph"), comment = "leaflet-measure plugin"), person("Joerg
        Dietrich", role = c("ctb", "cph"), comment = "Leaflet.Terminator
        plugin"), person("Benjamin Becquet", role = c("ctb", "cph"), comment
        = "Leaflet.MagnifyingGlass plugin"), person("Norkart AS", role =
        c("ctb", "cph"), comment = "Leaflet.MiniMap plugin"), person("L.
        Voogdt", role = c("ctb", "cph"), comment = "Leaflet.awesome-markers
        plugin"), person("Daniel Montague", role = c("ctb", "cph"), comment
        = "Leaflet.EasyButton plugin"), person("Kartena AB", role = c("ctb",
        "cph"), comment = "Proj4Leaflet plugin"), person("Robert Kajic",
        role = c("ctb", "cph"), comment = "leaflet-locationfilter plugin"),
        person("Mapbox", role = c("ctb", "cph"), comment = "leaflet-omnivore
        plugin"), person("Michael Bostock", role = c("ctb", "cph"), comment
        = "topojson"), person("RStudio", role = c("cph")) )
Description: Create and customize interactive maps using the 'Leaflet'
        JavaScript library and the 'htmlwidgets' package. These maps can be
        used directly from the R console, from 'RStudio', in Shiny
        applications and R Markdown documents.
License: GPL-3
URL: https://rstudio.github.io/leaflet/
BugReports: https://github.com/rstudio/leaflet/issues
Depends: R (>= 3.1.0)
Imports: base64enc, crosstalk, htmlwidgets, htmltools, magrittr, markdown,
        methods, png, RColorBrewer, raster, scales (>= 1.0.0), sp, stats,
        viridis (>= 0.5.1), leaflet.providers (>= 1.8.0)
Suggests: knitr, maps, sf (>= 0.9-6), shiny, rgdal, rgeos, R6, RJSONIO,
        purrr, testthat
RoxygenNote: 7.1.1
Encoding: UTF-8
LazyData: true
NeedsCompilation: no
Packaged: 2021-01-06 17:49:50 UTC; jcheng
Author: Joe Cheng [aut, cre], Bhaskar Karambelkar [aut], Yihui Xie [aut],
        Hadley Wickham [ctb], Kenton Russell [ctb], Kent Johnson [ctb],
        Barret Schloerke [ctb], jQuery Foundation and contributors [ctb,
        cph] (jQuery library), Vladimir Agafonkin [ctb, cph] (Leaflet
        library), CloudMade [cph] (Leaflet library), Leaflet contributors
        [ctb] (Leaflet library), Brandon Copeland [ctb, cph]
        (leaflet-measure plugin), Joerg Dietrich [ctb, cph]
        (Leaflet.Terminator plugin), Benjamin Becquet [ctb, cph]
        (Leaflet.MagnifyingGlass plugin), Norkart AS [ctb, cph]
        (Leaflet.MiniMap plugin), L. Voogdt [ctb, cph]
        (Leaflet.awesome-markers plugin), Daniel Montague [ctb, cph]
        (Leaflet.EasyButton plugin), Kartena AB [ctb, cph] (Proj4Leaflet
        plugin), Robert Kajic [ctb, cph] (leaflet-locationfilter plugin),
        Mapbox [ctb, cph] (leaflet-omnivore plugin), Michael Bostock [ctb,
        cph] (topojson), RStudio [cph]
Maintainer: Joe Cheng <joe@rstudio.com>
Repository: RSPM
Date/Publication: 2021-01-07 07:00:26 UTC
Built: R 4.0.3; ; 2021-02-12 05:39:17 UTC; unix

> packageDescription("sf")
Package: sf
Version: 0.9-8
Title: Simple Features for R
Authors@R: c(person(given = "Edzer", family = "Pebesma", role = c("aut",
        "cre"), email = "edzer.pebesma@uni-muenster.de", comment = c(ORCID =
        "0000-0001-8049-7069")), person(given = "Roger", family = "Bivand",
        role = "ctb", comment = c(ORCID = "0000-0003-2392-6140")),
        person(given = "Etienne", family = "Racine", role = "ctb"),
        person(given = "Michael", family = "Sumner", role = "ctb"),
        person(given = "Ian", family = "Cook", role = "ctb"), person(given =
        "Tim", family = "Keitt", role = "ctb"), person(given = "Robin",
        family = "Lovelace", role = "ctb"), person(given = "Hadley", family
        = "Wickham", role = "ctb"), person(given = "Jeroen", family =
        "Ooms", role = "ctb", comment = c(ORCID = "0000-0002-4035-0289")),
        person(given = "Kirill", family = "M\u00fcller", role = "ctb"),
        person(given = "Thomas Lin", family = "Pedersen", role = "ctb"),
        person(given = "Dan", family = "Baston", role = "ctb"))
Description: Support for simple features, a standardized way to encode
        spatial vector data. Binds to 'GDAL' for reading and writing data,
        to 'GEOS' for geometrical operations, and to 'PROJ' for projection
        conversions and datum transformations. Optionally uses the 's2'
        package for spherical geometry operations on geographic coordinates.
License: GPL-2 | MIT + file LICENSE
URL: https://r-spatial.github.io/sf/, https://github.com/r-spatial/sf/
BugReports: https://github.com/r-spatial/sf/issues/
Depends: methods, R (>= 3.3.0)
Imports: classInt (>= 0.4-1), DBI (>= 0.8), graphics, grDevices, grid,
        magrittr, Rcpp (>= 0.12.18), stats, tools, units (>= 0.6-0), utils
Suggests: blob, covr, dplyr (>= 0.8-3), ggplot2, knitr, lwgeom (>= 0.2-1),
        maps, mapview, microbenchmark, odbc, pillar, pool, raster, rgdal,
        rgeos, rlang, rmarkdown, RPostgres (>= 1.1.0), RPostgreSQL, RSQLite,
        s2 (>= 1.0.1), sp (>= 1.2-4), spatstat (>= 2.0-1), spatstat.geom,
        spatstat.core, spatstat.linnet, spatstat.utils, stars (>= 0.2-0),
        terra, testthat, tibble (>= 1.4.1), tidyr (>= 1.0-0), tidyselect (>=
        1.0.0), tmap (>= 2.0), vctrs
LinkingTo: Rcpp
VignetteBuilder: knitr
Encoding: UTF-8
RoxygenNote: 7.1.1
SystemRequirements: C++11, GDAL (>= 2.0.1), GEOS (>= 3.4.0), PROJ (>= 4.8.0),
        sqlite3
Collate: 'RcppExports.R' 'init.R' 'crs.R' 'bbox.R' 'read.R' 'db.R' 'sfc.R'
        'sfg.R' .....
NeedsCompilation: yes
Packaged: 2021-03-16 16:48:25 UTC; edzer
Author: Edzer Pebesma [aut, cre] (<https://orcid.org/0000-0001-8049-7069>),
        Roger Bivand [ctb] (<https://orcid.org/0000-0003-2392-6140>),
        Etienne Racine [ctb], Michael Sumner [ctb], Ian Cook [ctb], Tim
        Keitt [ctb], Robin Lovelace [ctb], Hadley Wickham [ctb], Jeroen Ooms
        [ctb] (<https://orcid.org/0000-0002-4035-0289>), Kirill Müller
        [ctb], Thomas Lin Pedersen [ctb], Dan Baston [ctb]
Maintainer: Edzer Pebesma <edzer.pebesma@uni-muenster.de>
Repository: RSPM
Date/Publication: 2021-03-17 10:50:03 UTC
Built: R 4.0.4; x86_64-pc-linux-gnu; 2021-03-24 19:50:50 UTC; unix

Here's a similar problem that I've found on RStudio Community: Unhandled Exception: 'NoneType' object has no attribute 'lower'

Thank you for your help.

Not seeing this error on my system, template shiny app.R with both sf (v. 0.9-7) and leaflet (v 2.0.4.1) on R 4.0.3 (Mac) & RStudio (1.4.1103) deployed to shinyapps.io without a problem.

Preparing to deploy application...DONE
Uploading bundle for application: 3851237...DONE
Deploying bundle: 4393653 for application: 3851237 ...
Waiting for task: 897595531
  building: Parsing manifest
  building: Building image: 5033439
  building: Installing system dependencies
  building: Fetching packages
  building: Installing packages
  building: Installing files
  building: Pushing image: 5033439
  deploying: Starting instances
  rollforward: Activating new instances
  success: Stopping old instances

Thanks for your reply. I could deploy to shinyapps.io from a Windows machine as well. The error occurs when deploying from my Linux PC (OpenSUSE Leap 15.2).

I'm on R 4.0.4 on both systems.