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

Latest netlify deploy has new warning message "calling IsSet with unsupported type" #901

Closed
deining opened this issue Feb 20, 2022 · 15 comments
Assignees

Comments

@deining
Copy link
Collaborator

deining commented Feb 20, 2022

With latest commit 66818eb in place, I now see a warning when serving the user guide.

8:27:49 PM: > hugo --cleanDestinationDir --themesDir ../.. "--minify"
8:27:49 PM: Start building sites …
8:27:49 PM: hugo v0.92.2-CDF6A0D6+extended linux/amd64 BuildDate=2022-02-11T14:17:39Z VendorInfo=gohugoio
8:27:50 PM: WARNING: calling IsSet with unsupported type "invalid" (<nil>) will always return false.

This warning can be seen also in the netlify log for this commit (line 95).

@raum51: is this warning related to the changes you submitted with #895?

@raum51
Copy link
Contributor

raum51 commented Feb 21, 2022

I'm afraid, that its related to my changes from #895, because I've build in isset on 2 places. Sorry.
On my test system there was no problems.

I'll take a look.

@raum51
Copy link
Contributor

raum51 commented Feb 21, 2022

But the issue with isset rises only a warning and in the next line of the log it shows an error:

8:27:53 PM: Error: Error building site: POSTCSS: failed to transform "scss/main.css" (text/css). Check your PostCSS installation; install with "npm install postcss-cli". See https://gohugo.io/hugo-pipes/postcss/: this feature is not available in your current Hugo version, see https://goo.gl/YMrWcn for more information

Look more like a problem with SCSS/CSS, I think.

@deining
Copy link
Collaborator Author

deining commented Feb 21, 2022

But the issue with isset rises only a warning and in the next line of the log it shows an error:

These are 2 different, unrelated issues:

For me, these are separate, independent issues, that's why a raised two separate issues (#900 / #901).
Thanks for investigating the warning message adressed with this ticket.

@chalin chalin changed the title Latest netlify deploy: warning message (new) Latest netlify deploy has new warning message "calling IsSet with unsupported type" Feb 22, 2022
@chalin
Copy link
Collaborator

chalin commented Feb 22, 2022

The build failure was my bad, and has been fixed. Thanks for reporting those @deining.

@raum51
Copy link
Contributor

raum51 commented Feb 22, 2022

Thanks @chalin for the info.

So also the warning caused by my PR #895 is solved or do I have to check it?

@chalin
Copy link
Collaborator

chalin commented Feb 22, 2022

So also the warning caused by my PR #895 is solved or do I have to check it?

The warning is still there, for example, see the latest production log.

@raum51
Copy link
Contributor

raum51 commented Feb 22, 2022

OK, I'll take a look after official work ;-)

@raum51
Copy link
Contributor

raum51 commented Feb 22, 2022

I think, I know why you get the warning. But I can't figure out, why I DON'T get the warning on my system. Hugo is building the site without any warning. I'm using hugo v0.92.2+extended darwin/amd64 on a MAC.

Have anyone an explanation for that?

@chalin
Copy link
Collaborator

chalin commented Feb 22, 2022

I'm using the same version of Hugo under macOS. Which command are you using to build?

@raum51
Copy link
Contributor

raum51 commented Feb 22, 2022

OK, I've found it. Was my fault: haven't build the userguide but my own site with dev content.

@raum51
Copy link
Contributor

raum51 commented Feb 22, 2022

Oh, there's a long story I'd completely forgotten.

The problem is, I want to control 3 different states with one parameter .Site.Params.Taxonomy.taxonomyCloud

  • default: show all defined taxonomies, when taxonomyCloud is not set
  • hide the taxonomy cloud by taxonomyCloud = []
  • show only specific clouds - e.g. taxonomyCloud = ["tags", "categories"]
    ==> Can't find a way to distinguish between not set and empty array.

The easiest way I see would be to set at least the parameter group [params.taxonomy] in our config.toml:

[params.taxonomy]
# taxonomyCloud = ["tags", "categories"] # set taxonomyCloud = [] to hide taxonomy clouds
# taxonomyCloudTitle = ["Tag Cloud", "Cloud of Categories"] # if used, must have same lang as taxonomyCloud
# taxonomyPageHeader = ["tags", "categories"] # set taxonomyPageHeader = [] to hide taxonomies on the page headers

instead of

docsy/userguide/config.toml

Lines 231 to 234 in f03cba0

# [params.taxonomy]
# taxonomyCloud = ["tags", "categories"] # set taxonomyCloud = [] to hide taxonomy clouds
# taxonomyCloudTitle = ["Tag Cloud", "Cloud of Categories"] # if used, must have same lang as taxonomyCloud
# taxonomyPageHeader = ["tags", "categories"] # set taxonomyPageHeader = [] to hide taxonomies on the page headers

==> Would this be OK? Or have anybody any other solution?

@chalin
Copy link
Collaborator

chalin commented Feb 28, 2022

I would not force projects to set a field.

I believe that use of isset is enough help you to distinguish between the cases of taxonomyCloud being set or not. You just might need a more complex if condition.

@chalin
Copy link
Collaborator

chalin commented Feb 28, 2022

Btw, I think that the problem is because you're testing whether a field of params.taxonomy is set before testing whether params.taxonomy is itself defined.

@raum51
Copy link
Contributor

raum51 commented Feb 28, 2022

Btw, I think that the problem is because you're testing whether a field of params.taxonomy is set before testing whether params.taxonomy is itself defined.

I've already thought about that possibility, but then I have to double the code for FALSE:

{{ $context := . }}
{{ if isset .Site.Params "taxonomy" }}
	{{ if isset .Site.Params.Taxonomy "taxonomycloud" }}
		{{ range $index, $taxo := .Site.Params.Taxonomy.taxonomyCloud }}
			{{ if isset $.Site.Params.Taxonomy "taxonomycloudtitle" }}
				{{ $.Scratch.Set "title" (index $.Site.Params.Taxonomy.taxonomyCloudTitle $index) }}
			{{ else }}
				{{ $.Scratch.Set "title" (humanize $taxo) }}
			{{ end }}
			{{ partial "taxonomy_terms_cloud.html" (dict "context" $context "taxo" $taxo "title" ($.Scratch.Get "title")) }}
		{{ end }}
	{{ else }}
		{{ range $taxo, $taxo_map := .Site.Taxonomies }}
			{{ partial "taxonomy_terms_cloud.html" (dict "context" $context "taxo" $taxo "title" (humanize $taxo)) }}
		{{ end }}
	{{ end }}
{{ else }}
	{{ range $taxo, $taxo_map := .Site.Taxonomies }}
		{{ partial "taxonomy_terms_cloud.html" (dict "context" $context "taxo" $taxo "title" (humanize $taxo)) }}
	{{ end }}
{{ end }}

But for me it's OK. I'll prepare the PR.

@chalin
Copy link
Collaborator

chalin commented Mar 5, 2022

Closed by #909

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants