You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This bug has been already addressed here : #12914
Since it's closed, and the bug remains, I re open another one.
The redirect method from @sveltejs/kit, when called from another library, is not working, and return a json object containing only the Redirect object, serialized.
The action code, from the application itself, called my-app, is pretty simple :
From the my-library, launch a npm run dev to bundle the library:
> npm run dev
rollup v4.41.0
bundles src/index.ts → dist...
created dist in 505ms
from the my-app
launch the application using npm run dev.
click on the button to trigger the action (that will call the library)
Instead of being redirected, we have a terminal output like this:
VITE v6.3.5 ready in 724 ms
➜ Local: http://localhost:5174/
➜ Network: use --host to expose
➜ press h + enter to show help
Redirect { status: 302, location: 'https://google.com' }
Instead of using instanceof Redirect, you should use isRedirect
It's likely caused by having a copy of the Redirect class somewhere along the way so it isn't an instance of the exact same thing ... this can be avoided by not bundling it in your lib project (one possible cause)
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
This bug has been already addressed here : #12914
Since it's closed, and the bug remains, I re open another one.
The redirect method from
@sveltejs/kit
, when called from another library, is not working, and return a json object containing only the Redirect object, serialized.The action code, from the application itself, called
my-app
, is pretty simple :and the code from
createMyLibraryRedirectFunction
from the library, calledmy-library
is also really simple:The result is
Redirect { status: 302, location: 'https://accounts.google.com/o/oauth2/v2/auth?response_type=code&client_id=....' }
After some investigations, as mentioned in the other issue, this code is causing the failure:
kit/packages/kit/src/runtime/server/page/actions.js
Lines 85 to 90 in b45cd46
instanceof
is not working as expected.I have tried several things:
@sveltejs/kit
that could cause that kind of error@sveltejs/kit
in different places in the package.json :dependencies
,devDependencies
,peerDependencies
Response
instead of callingredirect
(forbidden in Actions, by design)Reproduction
I ve created a repository containing
my-app
andmy-library
to reproduce the issue : https://github.com/[Mimetis/svelte-issue-redirect-from-library](https://github.com/Mimetis/svelte-issue-redirect-from-library)From the
my-library
, launch anpm run dev
to bundle the library:from the
my-app
npm run dev
.Instead of being redirected, we have a terminal output like this:
Logs
System Info
Severity
annoyance
Additional Information
No response
The text was updated successfully, but these errors were encountered: