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

http redirect cause an Invalid URL error. #497

Closed
maicss opened this issue Jan 19, 2023 · 2 comments
Closed

http redirect cause an Invalid URL error. #497

maicss opened this issue Jan 19, 2023 · 2 comments

Comments

@maicss
Copy link

maicss commented Jan 19, 2023

Non-blocking bug

In our project, we imported tailwind.css, for test env, I use CDN way to load tailwind. nuxt.config.ts:

  app: {
    head: {
      script: [
        {
          src: 'https://cdn.tailwindcss.com'
        }
      ]
    }
  }

In dev mode, it actually behaver:
1, request https://cdn.tailwindcss.com get: status code: 302, http header location: 3.2.4
2, request https://cdn.tailwindcss.com/3.2.4

TypeError: Invalid URL
    at new NodeError (node:internal/errors:393:5)
    at URL.onParseError (node:internal/url:565:9)
    at new URL (node:internal/url:645:5)
    at Function.getAbsoluteURL (xxx\node_modules\happy-dom\lib\location\RelativeURL.ts:16:16)
    at XMLHttpRequest._sendSyncRequest (xxx\node_modules\happy-dom\src\xml-http-request\XMLHttpRequest.ts:618:45)
    at XMLHttpRequest.send (xxx\node_modules\happy-dom\src\xml-http-request\XMLHttpRequest.ts:472:9)
    at Function.fetchSync (xxx\node_modules\happy-dom\src\fetch\ResourceFetchHandler.ts:39:7)
    at Function.loadExternalScript (xxx\node_modules\happy-dom\src\nodes\html-script-element\ScriptUtility.ts:63:5)
    at HTMLScriptElement._connectToNode (xxx\node_modules\happy-dom\src\nodes\html-script-element\HTMLScriptElement.ts:195:19)
    at HTMLElement.appendChild (xxx\node_modules\happy-dom\src\nodes\node\Node.ts:326:16) {
  input: '/3.2.4',
  code: 'ERR_INVALID_URL'
}
@maicss maicss changed the title Invalid URL http redirect cause an Invalid URL error. Jan 19, 2023
@maicss
Copy link
Author

maicss commented Jan 19, 2023

But after I change my config to:

app: {
    head: {
      script: [
        {
          src: 'https://cdn.tailwindcss.com/3.2.4'
        }
      ]
    }
  }

Another error occurs:

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Errors ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Vitest caught 1 unhandled error during the test run.
This might cause false positive tests. Resolve unhandled errors to make sure your tests are not affected.

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
TypeError: i.classList is not iterable
 ❯ Il node_modules/happy-dom/src/nodes/html-script-element/ScriptUtility.ts:85:31
 ❯ MutationObserver.observe.attributes [as callback] node_modules/happy-dom/src/nodes/html-script-element/ScriptUtility.ts:85:31
 ❯ HTMLElement.appendChild node_modules/happy-dom/src/nodes/node/Node.ts:340:15
 ❯ HTMLElement.appendChild node_modules/happy-dom/src/nodes/element/Element.ts:386:16
 ❯ node_modules/@unhead/vue/dist/index.cjs:180:20
 ❯ node_modules/@unhead/vue/dist/index.cjs:168:11
 ❯ renderDOMHead node_modules/@unhead/vue/dist/index.cjs:148:34
 ❯ runNextTicks node:internal/process/task_queues:60:5

This error originated in "app.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running.
⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
 FAIL  Tests failed. Watching for file changes...

@danielroe
Copy link
Member

This was resolved in #260 as we no longer render these links in the test environment.

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

No branches or pull requests

2 participants