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

fix(svelte): cannot parse action at /session #10219

Merged

Conversation

bwallberg
Copy link
Contributor

☕️ Reasoning

All frameworks should rely on the core util createActionsURL

🧢 Checklist

  • Documentation
  • Tests
  • Ready to be merged

🎫 Affected issues

Depends on #10094 to solve the relevant issue.

📌 Resources

fix: support apps hosted on subpaths
@bwallberg bwallberg requested a review from ThangHuuVu as a code owner March 5, 2024 07:36
Copy link

vercel bot commented Mar 5, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
auth-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Mar 16, 2024 2:58pm
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
next-auth-docs ⬜️ Ignored (Inspect) Visit Preview Mar 16, 2024 2:58pm

Copy link

vercel bot commented Mar 5, 2024

@bwallberg is attempting to deploy a commit to the authjs Team on Vercel.

A member of the Team first needs to authorize it.

Copy link

codecov bot commented Mar 8, 2024

Codecov Report

Attention: Patch coverage is 0% with 13 lines in your changes are missing coverage. Please review.

Project coverage is 39.37%. Comparing base (3c035ec) to head (8dcea95).

Files Patch % Lines
packages/frameworks-sveltekit/src/lib/actions.ts 0.00% 13 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10219      +/-   ##
==========================================
+ Coverage   39.35%   39.37%   +0.02%     
==========================================
  Files         171      171              
  Lines       27292    27278      -14     
  Branches     1165     1165              
==========================================
  Hits        10742    10742              
+ Misses      16550    16536      -14     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

packages/frameworks-sveltekit/src/lib/actions.ts Outdated Show resolved Hide resolved
packages/frameworks-sveltekit/src/lib/actions.ts Outdated Show resolved Hide resolved
packages/frameworks-sveltekit/src/lib/actions.ts Outdated Show resolved Hide resolved
@ThangHuuVu ThangHuuVu merged commit 5ea8b7b into nextauthjs:main Mar 16, 2024
12 of 15 checks passed
@bwallberg bwallberg deleted the fix/svelte-kit_cannot_parse_action branch March 22, 2024 08:17
@aakash14goplani
Copy link

aakash14goplani commented Mar 29, 2024

@ThangHuuVu @bwallberg and @ndom91
The recent upgrade i.e. 0.14.1 broke my application

Here is my configuration that was working fine till 0.14.0

  • NO Authjs specific environment variables set in .env file
  • High level config object:
    export const { handle: getAuthConfig } = SvelteKitAuth(async (event) => {
      const useSecureCookies = !dev;
      const config: SvelteKitAuthConfig = {
        providers: [
         { ... }
        ],
        basePath: '/my-app/auth',
        pages: {
          error: '/server-auth-error'
        }
      }
    };
  • In svelte.config, it is set as
    kit: {
      adapter: adapter(),
      paths: {
        base: '/my-app',
        relative: false
      }
    }

After upgrade, I am getting error:

Error caught in [server-hooks]: Invalid URL TypeError: Invalid URL
at new URL (node:internal/url:775:36)
at Module.createActionURL (file:/node_modules/.pnpm/@[email protected]/node_modules/@auth/core/lib/utils/env.js:66:15)
at Module.auth (\node_modules.pnpm@auth+sveltekit@0.14.1_@sveltejs[email protected][email protected]\node_modules@auth\sveltekit\dist\actions.js:69:24)
at event.locals.auth (\node_modules.pnpm@auth+sveltekit@0.14.1_@sveltejs[email protected][email protected]\node_modules@auth\sveltekit\dist\index.js:323:41)
at userSessionInterceptor (src\hooks.server.ts:24:37)
at apply_handle (node_modules.pnpm@sveltejs+kit@2.5.5_@sveltejs[email protected][email protected][email protected]\node_modules@sveltejs\kit\src\exports\hooks\sequence.js:85:11)
at resolve (node_modules.pnpm@sveltejs+kit@2.5.5_@sveltejs[email protected][email protected][email protected]\node_modules@sveltejs\kit\src\exports\hooks\sequence.js:110:9)
at handle (node_modules.pnpm@auth+sveltekit@0.14.1_@sveltejs[email protected][email protected]\node_modules@auth\sveltekit\dist\index.js:334:20)
at async Module.respond (\node_modules.pnpm@sveltejs+kit@2.5.5_@sveltejs[email protected][email protected][email protected]\node_modules@sveltejs\kit\src\runtime\server\respond.js:319:20)
at async file:/node_modules/.pnpm/@sveltejs+kit@2.5.5_@sveltejs[email protected][email protected][email protected]/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:524:22 {
code: 'ERR_INVALID_URL',
input: 'http:://localhost:4200'

What am I missing here?

@ndom91
Copy link
Member

ndom91 commented Mar 30, 2024

@aakash14goplani this is unrelated, but you should have an AUTH_SECRET env var set or a secret configuration option.

Regarding your error, looks like its an actual issue. Someone submitted a PR for it here: https://github.com/nextauthjs/next-auth/pull/10421/files

We'll merge it soon 🙏

JipSterk pushed a commit to JipSterk/next-auth that referenced this pull request Apr 3, 2024
* fix(svelte): cannot parse action at /session

fix: support apps hosted on subpaths

* Apply suggestions from code review

* Apply suggestions from code review

---------

Co-authored-by: Nico Domino <[email protected]>
Co-authored-by: Thang Vu <[email protected]>
JipSterk pushed a commit to JipSterk/next-auth that referenced this pull request Apr 3, 2024
* fix(svelte): cannot parse action at /session

fix: support apps hosted on subpaths

* Apply suggestions from code review

* Apply suggestions from code review

---------

Co-authored-by: Nico Domino <[email protected]>
Co-authored-by: Thang Vu <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants