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

Error: Type '"origin" | undefined' is not assignable to type '"origin"' during Build. #1202

Open
us24man opened this issue May 12, 2024 · 7 comments
Labels
triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.

Comments

@us24man
Copy link

us24man commented May 12, 2024

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:

  1. Create a Next JS app
  2. Install the latest version of this package
  3. Build

package version 3.4.0
Next JS version 14.2.3
Typescript version ^5

@us24man us24man added triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. labels May 12, 2024
@us24man us24man changed the title Type error: Type '"origin" | undefined' is not assignable to type '"origin"'. Error: Type '"origin" | undefined' is not assignable to type '"origin"' during Build. May 12, 2024
@wangela
Copy link
Member

wangela commented May 12, 2024

If you would like to upvote the priority of this issue, please comment below or react on the original post above with 👍 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:

This is an automated message, feel free to ignore.

@us24man
Copy link
Author

us24man commented May 18, 2024

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.

@majovkovic
Copy link

@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?

@us24man
Copy link
Author

us24man commented May 26, 2024

@majovkovic thank you for responding here.
My node version is 20.11.1

@majovkovic
Copy link

@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
Copy link
Author

us24man commented May 27, 2024

@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";

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.

@majovkovic
Copy link

Most likely something else causes a problem. Anyway, good luck with your project.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

3 participants