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
[vite-plugin-inlang-sdk-js-sveltekit]
Could not find the folder '\src\routes\[lang]'.
It is needed in order to circumvent a current limitation of SvelteKit. See https://github.com/inlang/inlang/issues/647.
Please create the folder and move all existing route files into it.
This is expected.
I just create the dynamic route and move my pages there (this is not the problem). Everything goes well if I run my dev server.
The problem is that when I build the project with adapter-cloudflare, it goes fine until the adapter kicks in:
> Using @sveltejs/adapter-cloudflare
node:internal/event_target:1010
process.nextTick(() => { throw err; });
^
Error: Could not create a fallback page — failed with status 307
at generate_fallback (file:///C:/Users/Carlos/Projects/melt-ui-test/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@sveltejs/kit/src/core/postbuild/fallback.js:53:8)
at async MessagePort.<anonymous> (file:///C:/Users/Carlos/Projects/melt-ui-test/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@sveltejs/kit/src/utils/fork.js:22:16)
Emitted 'error' event on Worker instance at:
at [kOnErrorMessage] (node:internal/worker:290:10)
at [kOnMessage] (node:internal/worker:301:37)
at MessagePort.<anonymous> (node:internal/worker:202:57)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:735:20)
at exports.emitMessage (node:internal/per_context/messageport:23:28)
Node.js v18.15.0
However, if I downgrade the @sveltejs/adapter-cloudflare to v2.1.0, it builds successfully.
> Using @sveltejs/adapter-cloudflare
✔ done
✓ built in 18.64s
I think this might be happening because if I set the strategy to be "url" in the inlang config, we need to add all our pages inside a dynamic lang param at the root of the routes folder: routes/[lang]/+page.svelte so that Inlang can detect the locale based on the url and do automatic language specific routing. And this is what generates the problem.
There's another workaround (different than downgrading the adapter): set the language strategy to be 'localStorage', move the pages from routes/[lang]/+page.svelte to routes/+page.svelte and the error disappears!
> Using @sveltejs/adapter-cloudflare
node:internal/event_target:1010
process.nextTick(() => { throw err; });
^
Error: Could not create a fallback page — failed with status 307
at generate_fallback (file:///C:/Users/Carlos/Projects/melt-ui-test/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@sveltejs/kit/src/core/postbuild/fallback.js:53:8)
at async MessagePort.<anonymous> (file:///C:/Users/Carlos/Projects/melt-ui-test/node_modules/.pnpm/@[email protected][email protected][email protected]/node_modules/@sveltejs/kit/src/utils/fork.js:22:16)
Emitted 'error' event on Worker instance at:
at [kOnErrorMessage] (node:internal/worker:290:10)
at [kOnMessage] (node:internal/worker:301:37)
at MessagePort.<anonymous> (node:internal/worker:202:57)
at [nodejs.internal.kHybridDispatch] (node:internal/event_target:735:20)
at exports.emitMessage (node:internal/per_context/messageport:23:28)
Node.js v18.15.0
This is definitely a duplicate of #9386 caused by #9294
In terms of your issue, I don't know anything about inlang but figuring out why it's causing a 307 when trying to render the fallback and preventing that would be the quickest workaround IMO
@buhodev this has been fixed in version 0.9.1 of @inlang/sdk-js.
The issue was that the cloudflare adapter tries generates a 404.html page and therefore makes a request to /[fallback] which should render a 404 page. The SDK now ignores that request.
Uh oh!
There was an error while loading. Please reload this page.
Describe the bug
I am trying to use Inlang for i18n with the SDK for SvelteKit. For the language negotiation option I set the strategy to be "URL".
If I run the dev server, I get this error:
This is expected.
I just create the dynamic route and move my pages there (this is not the problem). Everything goes well if I run my dev server.
The problem is that when I build the project with adapter-cloudflare, it goes fine until the adapter kicks in:
However, if I downgrade the
@sveltejs/adapter-cloudflare
tov2.1.0
, it builds successfully.I think this might be happening because if I set the strategy to be
"url"
in the inlang config, we need to add all our pages inside a dynamiclang
param at the root of theroutes
folder:routes/[lang]/+page.svelte
so that Inlang can detect the locale based on the url and do automatic language specific routing. And this is what generates the problem.There's another workaround (different than downgrading the adapter): set the language strategy to be
'localStorage'
, move the pages fromroutes/[lang]/+page.svelte
toroutes/+page.svelte
and the error disappears!console:
Reproduction
https://github.com/buhodev/melt-ui-starter/
To see the bug:
build
command and see the error when adapter-cloudflare kicks in.1st workaround:
'localStorage'
instead of'url'
inside theinlang.config.js
fileroutes/[lang]/+page.svelte
toroutes/+page.svelte
2nd workaround:
@sveltejs/adapter-cloudflare
Logs
System Info
Severity
blocking an upgrade
Additional Information
It seems related to this issue #9386 that is caused by this update #9294
The text was updated successfully, but these errors were encountered: