-
Notifications
You must be signed in to change notification settings - Fork 9
Auth.requestToken(): input
must not start with a slash when using prefixUrl
#8
Comments
I am seeing the same error and after doing some digging, I found that this is caused by a bug in the Ably dependency |
Hey Mariesta, |
@thisisjofrank I don't think your solution solves this problem. I am also still struggling with the same exact symptoms as the OP, but my got version is |
I am having the same issue. Currently, the only solution is to manually modify the authUrl to be absolute (which would be different e.g. in dev and prod) |
Yeah this is annoying, @thisisjofrank should this really be closed? |
I'm afraid I no longer work on this product. Please email [email protected] to get some eyes on it. |
➤ Automation for Jira commented: The link to the corresponding Jira issue is https://ably.atlassian.net/browse/SDK-3812 |
We understand this issue may have been closed while the fix for it was not working. Apologies about that, I have now re-opened the issue and we will look into it in the next week. |
Hey all, thanks for raising this issue with us! This error message actually comes from The real problem if you're seeing this issue, is that your NextJS application is creating an Ably client on the server side (ie in a NodeJS process) but really the Ably client should only be created on the client side. In my experience, the best way to ensure that this never happens is to wrap components which contain client-only code in a import dynamic from 'next/dynamic';
const DynamicAblyComponent = dynamic(() => import('./path/to/your/ably/component'), {
ssr: false, // this ensures that server side rendering is never used for this component
})
export default DynamicAblyComponent; If the above solution doesn't work for you, there are a few alternatives documented here. It's worth mentioning also that, while the name 'Client Components' (ie components with the I hope this clears things up, please let us know here if you have any further questions 🙂 |
There is something more dastardly going on here that really underscores the importance of using dynamic import for your client-side ably. If you are seeing phantom connections/subscribers on your ably dashboard this could be the reason why. I am still trying to figure out how to export my |
@starlight-akouri Let me know if you find a solution. I'm using Remix and it doesn't have dynamic function like nextjs, so I'm running into a similar issue as you I think. |
@starlight-akouri, I'm sorry to hear that you're still having issues here. It sounds like something in your application code is creating more ably-js clients than it should, but it's hard to say what the issue is without seeing some code. If you're able to share a repro I'd be happy to take a look? |
@sikula, it should be possible to achieve the same thing as next/dynamic in remix by using the ClientOnly component. Let me know if you have any issues with setting this up with Ably. FWIW as briefly mentioned above, the fundamental issue here is that it's impossible to resolve a URL beginning with a |
@sikula, fyi I'm using Remix.run and it works fine with
|
Context
I have installed
ably-labs/react-hooks
in order to use the configureAbly() and useChannel hook in My Next.js app. I created an API endpoint for authentication:And called
configureAbly
in my component:It works fine apart from the fact that I get log messages in my server:
I have tried removing the slash (this causes an issue) and I have moved the
configureAbly
in various places (inside a component, in_app.js
), but it still appears. There is a new one every 30 seconds. Any idea what might cause it?The text was updated successfully, but these errors were encountered: