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

Problem parsing cookie header causing yarn install to fail #607

Open
MattMoranJava opened this issue May 19, 2017 · 7 comments
Open

Problem parsing cookie header causing yarn install to fail #607

MattMoranJava opened this issue May 19, 2017 · 7 comments

Comments

@MattMoranJava
Copy link

My frontend build is failing with the following log:

[INFO] --- frontend-maven-plugin:1.2:install-node-and-yarn (install node and yarn) @ cdx-frontend ---
[INFO] Installing node version v6.2.2
[INFO] Unpacking /root/.m2/repository/com/github/eirslett/node/6.2.2/node-6.2.2-linux-x64.tar.gz into /usr/local/build/cdxwww/react-frontend/target/node/tmp
[INFO] Copying node binary from /usr/local/build/cdxwww/react-frontend/target/node/tmp/node-v6.2.2-linux-x64/bin/node to /usr/local/build/cdxwww/react-frontend/target/node/node
[INFO] Installed node locally.
[INFO] Installing Yarn version v0.16.1
[INFO] Downloading https://github.com/yarnpkg/yarn/releases/download/v0.16.1/yarn-v0.16.1.tar.gz to /root/.m2/repository/com/github/eirslett/yarn/0.16.1/yarn-0.16.1./yarn-v0.16.1.tar.gz
[INFO] No proxies configured
[INFO] No proxy was configured, downloading directly
May 19, 2017 9:18:33 AM org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Invalid cookie header: "Set-Cookie: logged_in=no; domain=.github.com; path=/; expires=Tue, 19 May 2037 09:18:36 -0000; secure; HttpOnly". Invalid 'expires' attribute: Tue, 19 May 2037 09:18:36 -0000
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary:
[INFO]
[INFO] cdx-parent ......................................... SUCCESS [ 2.076 s]
[INFO] cdx-frontend ....................................... FAILURE [ 40.378 s]
[INFO] cdxwww Webapp ...................................... SKIPPED
[INFO] Project Aggregator ................................. SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 43.055 s
[INFO] Finished at: 2017-05-19T09:18:36Z
[INFO] Final Memory: 15M/172M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.2:install-node-and-yarn (install node and yarn) on project cdx-frontend: Could not download Yarn: Could not download https://github.com/yarnpkg/yarn/releases/download/v0.16.1/yarn-v0.16.1.tar.gz: /root/.m2/repository/com/github/eirslett/yarn/0.16.1/yarn-0.16.1./yarn-v0.16.1.tar.gz (No such file or directory) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR] mvn -rf :cdx-frontend
Do you want to request a feature or report a bug?
Report a bug. I believe it may be possible to overcome this by setting a System property to be able to parse the latest format cookie headers.
What is the current behavior?
Failing due to being unable to parse the cookie header expiry coming from yarn's github.
If the current behavior is a bug, please provide the steps to reproduce.
Run install-node-and-yarn in maven.
What is the expected behavior?
Yarn should be installed
Please mention your frontend-maven-plugin and operating system version.
frontend-maven-plugin v1.2, OS is complex: Debian Jessie running as a Docker container inside Windows 10

@mriehema
Copy link
Contributor

Please update to latest frontend-maven-plugin. Does the error still occur?

@MattMoranJava
Copy link
Author

Yep, still happens with 1.4.
I think the problem is that the spec for cookie headers specifies that the Expires attribute should be capitalised, and the one returned by github for yarn is "expires", all lower case. We either need them to fix their side or we need to make our cookie parsing more resilient. ISTR there's a way to do this in Java by setting a system property, but I'm not 100% sure of exactly what to do, or I'd fix it myself :-)

@detro
Copy link

detro commented Jun 13, 2017

This is happening to me as well:

Jun 13, 2017 1:20:37 PM org.apache.http.client.protocol.ResponseProcessCookies processCookies
WARNING: Invalid cookie header: "Set-Cookie: logged_in=no; domain=.github.com; path=/; expires=Sat, 13 Jun 2037 13:20:37 -0000; secure; HttpOnly". Invalid 'expires' attribute: Sat, 13 Jun 2037 13:20:37 -0000
[ERROR] error Bad hash. Expected "f8990e71c9cd180a842b07e09e0801fe84e83878" but got "71046f074813d02439ba0af58816f39b37c8aa9f" 
[ERROR] error Command failed with exit code 1.
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.4:yarn (yarn install) on project synthetics-web: Failed to run task: 'yarn run install-offline' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 1 (Exit value: 1) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException

This is how I have the plugin configured:

<plugin>
          <groupId>com.github.eirslett</groupId>
          <artifactId>frontend-maven-plugin</artifactId>
          <version>1.4</version>
        </plugin>
...
<groupId>com.github.eirslett</groupId>
        <artifactId>frontend-maven-plugin</artifactId>
        <executions>
          <execution>
            <id>install node and yarn</id>
            <goals>
              <goal>install-node-and-yarn</goal>
            </goals>
            <phase>generate-resources</phase>
          </execution>
          <execution>
            <id>yarn install</id>
            <goals>
              <goal>yarn</goal>
            </goals>
            <phase>generate-resources</phase>
            <configuration>
              <arguments>run install-offline</arguments>
            </configuration>
          </execution>
          <execution>
            <id>webpack build</id>
            <goals>
              <goal>webpack</goal>
            </goals>
            <phase>generate-resources</phase>
            <configuration>
              <arguments>-prod</arguments>
            </configuration>
          </execution>
        </executions>
        <configuration>
          <nodeVersion>v4.8.3</nodeVersion>
          <yarnVersion>v0.24.6</yarnVersion>
          <failOnError>true</failOnError>
        </configuration>
      </plugin>

How can we circumvent this issue?

@auxiliaire
Copy link

I guess I'm having the same issue with 1.6:

INFO  [2018-02-22 22:18:31,691] [Hotswap] Downloading https://github.com/yarnpkg/yarn/releases/download/npm-v1.3.2.tgz to C:\Users\vikto\.m2\repository\com\github\eirslett\npm\1.3.2\npm-1.3.2.tar.gz
INFO  [2018-02-22 22:18:31,693] [Hotswap] No proxies configured
INFO  [2018-02-22 22:18:31,693] [Hotswap] No proxy was configured, downloading directly
febr. 22, 2018 10:18:32 DU org.apache.http.client.protocol.ResponseProcessCookies processCookies
INFO  [2018-02-22 22:18:32,891] [Hotswap] Stopped
WARNING: Invalid cookie header: "Set-Cookie: logged_in=no; domain=.github.com; path=/; expires=Mon, 22 Feb 2038 21:18:32 -0000; secure; HttpOnly". Invalid 'expires' attribute: Mon, 22 Feb 2038 21:18:32 -0000
ERROR [2018-02-22 22:18:32,893] [Hotswap] An error occurred while starting the application:
com.github.eirslett.maven.plugins.frontend.lib.InstallationException: Could not download npm
	at com.github.eirslett.maven.plugins.frontend.lib.NPMInstaller.installNpm(NPMInstaller.java:167)

I'm running in IntelliJ on Windows 10.

@fdlk
Copy link

fdlk commented Oct 11, 2018

I think the warning is unrelated to the failure, since I came here looking for the warning but the build succeeds on my machine.

@wilx
Copy link

wilx commented May 29, 2020

I am noticing this too, with 1.9.1:

00:01:09.066 WARNING: Invalid cookie header: "Set-Cookie: logged_in=no; Path=/; Domain=github.com; Expires=Sat, 29 May 2021 13:03:41 GMT; HttpOnly; Secure; SameSite=Lax". Invalid 'expires' attribute: Sat, 29 May 2021 13:03:41 GMT

@JanBdot
Copy link

JanBdot commented Sep 22, 2020

I experienced the same issue and the reason was that one repository from my package.json was set to private.
That's why the plugin wanted to set a github cookie in the first place.
It showed in the Server Log, but not on the Console, so it took me forever to find the error.

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

7 participants