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

Errors when using with NextJS App Directory: DYNAMIC_SERVER_USAGE; "no exported member" #124

Closed
tordans opened this issue Oct 25, 2023 · 3 comments

Comments

@tordans
Copy link
Contributor

tordans commented Oct 25, 2023

We are migrating radverkehrsatlas.de https://github.com/FixMyBerlin/atlas-app to NextJS using the App Directory and BlitzJS.

I notices to issues related to osm-auth. I want to document them here FYI and so others might find them. We will be moving our OsmAuth server side, so the issue is not pressing for us ATM.

Error Uncaught Error: DYNAMIC_SERVER_USAGE when

I documented the error at blitz-js/blitz#4232 with a log of the error message. I now notice, that this error goes away once we remove the osm-auth dependency. So I assume this is where it came from.

Maybe relevant: In our previous setup as a regular React App, there was also a console error in dev mode related to some re-rendering. This might be the same issues that shows different in the different environments.

Error Module '"osm-auth"' has no exported member 'osmAuth'.ts(2305)

I get this error on this line: import { osmAuth } from 'osm-auth'

Screenshot:
image

@bhousel
Copy link
Member

bhousel commented Oct 25, 2023

oh that is weird!
The named import is how we work with osm-auth in Rapid also:
https://github.com/facebook/Rapid/blob/acf8744a46a2fede677f1b7f4238996a811a7df3/modules/services/OsmService.js#L4

The error is coming from TypeScript so maybe there is a problem with how the export appears in our osm-auth.d.ts file. I'm not really familiar with how this should look..

@tordans
Copy link
Contributor Author

tordans commented Oct 26, 2023

Just checked with @pietervdvn wo uses the library in a TS env as well and he also has the "does not export this class" error. Ignoring the error does work, though :) https://github.com/pietervdvn/MapComplete/blob/develop/src/Logic/Osm/OsmConnection.ts#L1-L2

Unfortunately I know nothing about how to handle the esm/mjs/ts situation that comes with creating packages (and everything else for that matter :)). Maybe https://www.youtube.com/watch?v=eh89VE3Mk5g has a hint?

@starsep
Copy link
Contributor

starsep commented Jan 9, 2024

I can confirm that #125 fixed the issue for OpenAEDMap.
Previously we @ts-ignored osm-auth
Thanks!

@tordans tordans closed this as completed Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants