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

gatsby-plugin-google-analytics: "cookieFlags" is not allowed - Invalid plugin options #27833

Closed
mohsenkhanpour opened this issue Nov 4, 2020 · 3 comments · Fixed by #27914 or #27923
Closed
Assignees
Labels
topic: plugins-analytics Various analytics plugins like gatsby-plugin-google-analytics type: bug An issue or pull request relating to a bug in Gatsby

Comments

@mohsenkhanpour
Copy link

Description

After recent update which enabled plugin option validation, gatsby-plugin-google-analytics throws with the following:

error Invalid plugin options for "gatsby-plugin-google-analytics":

- "cookieFlags" is not allowed
not finished load plugins - 9.797s

Although gatsby-plugin-google-analytics list cookieFlags as an option, it is not allowed after the latest update.

Steps to reproduce

  1. Update gatsby and gatsby-plugin-google-analytics
  2. Add cookieFlags option:
		{
			resolve: `gatsby-plugin-google-analytics`,
			options: {
				// replace "UA-XXXXXXXXX-X" with your own Tracking ID
				trackingId: 'UA-XXXXXXXXX-X',
				cookieFlags: 'Secure;SameSite=None',
			},
		},

Expected result

It should be accepted as a valid plugin option.

Actual result

It is not allowed and throws build process.

Environment

Run gatsby info --clipboard in your project directory and paste the output here.

npmPackages:
    gatsby: 2.25.2 => 2.25.2 
    gatsby-plugin-google-analytics: ^2.4.0 => 2.4.0 
@mohsenkhanpour mohsenkhanpour added the type: bug An issue or pull request relating to a bug in Gatsby label Nov 4, 2020
@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Nov 4, 2020
@LekoArts LekoArts added topic: plugins-analytics Various analytics plugins like gatsby-plugin-google-analytics and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels Nov 4, 2020
@mxstbr mxstbr self-assigned this Nov 9, 2020
@mohsenkhanpour
Copy link
Author

@mxstbr Thanks for updating the schema, I just saw that some optional options were added.
However I took a look at https://github.com/gatsbyjs/gatsby/blob/master/packages/gatsby-plugin-google-analytics/src/gatsby-node.js and cookieFlags was not added to schema, please inspect.

@mxstbr
Copy link
Contributor

mxstbr commented Nov 9, 2020

Oops I forgot the one key you were talking about, super sorry about that! 🤦

@mohsenkhanpour
Copy link
Author

@mxstbr Many thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: plugins-analytics Various analytics plugins like gatsby-plugin-google-analytics type: bug An issue or pull request relating to a bug in Gatsby
Projects
None yet
3 participants