google-maps-services-js
google-maps-services-js copied to clipboard
Error: Type '"origin" | undefined' is not assignable to type '"origin"' during Build.
While building my Next JS project using "npm run build" I get this error.
Type error: Type '"origin" | undefined' is not assignable to type '"origin"'.
Type 'undefined' is not assignable to type '"origin"'.
./node_modules/@googlemaps/js-api-loader/src/index.ts:301:5
299 | }: LoaderOptions) {
300 | this.apiKey = apiKey;
> 301 | this.authReferrerPolicy = authReferrerPolicy;
| ^
302 | this.channel = channel;
303 | this.client = client;
304 | this.id = id || DEFAULT_ID; // Do not allow empty string
This is really annoying as i am unable to deploy the app to Vercel because of this.
Steps to reproduce:
- Create a Next JS app
- Install the latest version of this package
- Build
package version 3.4.0 Next JS version 14.2.3 Typescript version ^5
If you would like to upvote the priority of this issue, please comment below or react on the original post above with :+1: so we can see what is popular when we triage.
@us24man Thank you for opening this issue. 🙏 Please check out these other resources that might help you get to a resolution in the meantime:
- Check the issue tracker - bugs and feature requests for Google Maps Platform APIs and SDKs
- Open a support case - Get 1:1 support in Cloud Console.
- Discord - chat with other developers
- StackOverflow - use the
google-mapstag
This is an automated message, feel free to ignore.
I am unable to deploy my project to vercel due to this. Not sure if others are facing the same issue but this is pretty important for me.
@us24man Hello, I tried to reproduce your problem with same setup and everything works fine, I can build application.
"@googlemaps/google-maps-services-js": "^3.4.0",
"next": "14.2.3",
"typescript": "^5"
What version of Node you're using?
@majovkovic thank you for responding here. My node version is 20.11.1
@us24man Okay I dont think its about Node version. I'am passing build with 20.11.1.
I would try to set "this.authReferrerPolicy" to:
this.authReferrerPolicy = authReferrerPolicy || "origin";
or
this.authReferrerPolicy = "origin";
@us24man Okay I dont think its about Node version. I'am passing build with 20.11.1. I would try to set "this.authReferrerPolicy" to:
this.authReferrerPolicy = authReferrerPolicy || "origin";orthis.authReferrerPolicy = "origin";
I could go into node_modules and modify this to build locally but the issue will persist on Vercel. But the fact that you could build your Next JS app with this package installed means I might have some other package conflicting with it and causing issues in Build.
Most likely something else causes a problem. Anyway, good luck with your project.