While deploying my NuxtJS application on Vercel, the hasura-auth-js
is breaking for some reason. This wasn't happening until a month ago. And I didn't even change anything on my end. I'm also not getting this error locally. Everything is working fine locally.
I've tried changing multiple versions of @nhost/nhost-js
. But none of them could solve this issue. Even tried falling back on v0.3.12
. Even that didn't work.
Something is happening in @nhost/hasura-auth-js. Something that wasn't happening a month before.
Maybe @plmercereau can take a look at this.
ERROR in ./node_modules_dev/@nhost/hasura-auth-js/dist/index.cjs.js 1:8801
Module parse failed: Unexpected token (1:8801)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> var A=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var U=Object.getOwnPropertyNames,p=Object.getOwnPropertySymbols;var y=Object.prototype.hasOwnProperty,I=Object.prototype.propertyIsEnumerable;var P=(i,e,n)=>e in i?A(i,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):i[e]=n,d=(i,e)=>{for(var n in e||(e={}))y.call(e,n)&&P(i,n,e[n]);if(p)for(var n of p(e))I.call(e,n)&&P(i,n,e[n]);return i};var N=i=>A(i,"__esModule",{value:!0});var T=(i,e)=>{var n={};for(var t in i)y.call(i,t)&&e.indexOf(t)<0&&(n[t]=i[t]);if(i!=null&&p)for(var t of p(i))e.indexOf(t)<0&&I.call(i,t)&&(n[t]=i[t]);return n};var x=(i,e)=>{for(var n in e)A(i,n,{get:e[n],enumerable:!0})},k=(i,e,n,t)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of U(e))!y.call(i,r)&&(n||r!=="default")&&A(i,r,{get:()=>e[r],enumerable:!(t=O(e,r))||t.enumerable});return i};var D=(i=>(e,n)=>i&&i.get(e)||(n=k(N({}),e,1),i&&i.set(e,n),n))(typeof WeakMap!="undefined"?new WeakMap:0);var L={};x(L,{HasuraAuthClient:()=>C});var m=require("xstate"),o=require("@nhost/core");var E=require("@nhost/core"),g=()=>typeof window<"u",c=i=>!i||!i.accessToken.value||!i.refreshToken.value?null:{accessToken:i.accessToken.value,accessTokenExpiresIn:(i.accessToken.expiresAt.getTime()-Date.now())/1e3,refreshToken:i.refreshToken.value,user:i.user},l=(i,e)=>{e.forEach(n=>{typeof i[n]!="function"&&console.error(`clientStorage.${n} is not a function`)})},w=(i,e)=>{if(e){if(i==="react-native"||i==="custom")return l(e,["getItem"]),n=>{var t;return(t=e.getItem)==null?void 0:t.call(e,n)};if(i==="capacitor")return l(e,["get"]),n=>{var t;return(t=e.get)==null?void 0:t.call(e,{key:n})};if(i==="expo-secure-storage")return l(e,["getItemAsync"]),n=>{var t;return(t=e.getItemAsync)==null?void 0:t.call(e,n)}}return E.defaultClientStorageGetter},R=(i,e)=>{if(e){if(i==="react-native"||i==="custom")return l(e,["setItem","removeItem"]),(n,t)=>{var r,s;t?(r=e.setItem)==null||r.call(e,n,t):(s=e.removeItem)==null||s.call(e,n)};if(i==="capacitor")return l(e,["set","remove"]),(n,t)=>{var r,s;t?(r=e.set)==null||r.call(e,{key:n,value:t}):(s=e.remove)==null||s.call(e,{key:n})};if(i==="expo-secure-storage")return l(e,["setItemAsync","deleteItemAsync"]),async(n,t)=>{var r,s;t?await((r=e.setItemAsync)==null?void 0:r.call(e,n,t)):(s=e.deleteItemAsync)==null||s.call(e,n)}}return E.defaultClientStorageSetter};var S={message:"User is already signed in",status:100},b={message:"User is not authenticated",status:101},G={message:"User is not anonymous",status:101},M={message:"Email needs verification",status:102},C=class{constructor({url:e,autoRefreshToken:n=!0,autoLogin:t=!0,clientStorage:r,clientStorageType:s="web",clientStorageGetter:u,clientStorageSetter:a,refreshIntervalTime:f,start:h=!0,Client:_=o.AuthClient}){this._client=new _({backendUrl:e,autoRefreshToken:n,autoSignIn:t,start:h,clientStorageGetter:u||w(s,r),clientStorageSetter:a||R(s,r),refreshIntervalTime:f})}async signUp(e){let n=await this.waitUntilReady(),{email:t,password:r,options:s}=e;return this.isAuthenticated()?{session:null,error:S}:new Promise(u=>{n.send({type:"SIGNUP_EMAIL_PASSWORD",email:t,password:r,options:s}),n.onTransition(a=>{if(a.matches({authentication:{signedOut:"needsEmailVerification"}}))return u({session:null,error:null});if(a.matches({authentication:{signedOut:"failed"}}))return u({session:null,error:a.context.errors.registration||null});if(a.matches({authentication:"signedIn"}))return u({session:c(a.context),error:null})})})}async signIn(e){let n=await this.waitUntilReady();if(this.isAuthenticated())return{session:null,mfa:null,error:S};if("provider"in e){let{provider:t,options:r}=e,s=(0,o.encodeQueryParameters)(`${this._client.backendUrl}/signin/provider/${t}`,(0,o.rewriteRedirectTo)(this._client.clientUrl,r));return g()&&(window.location.href=s),{providerUrl:s,provider:t,session:null,mfa:null,error:null}}return"email"in e&&"password"in e?new Promise(t=>{n.send(d({type:"SIGNIN_PASSWORD"},e)),n.onTransition(r=>{r.matches({authentication:"signedIn"})?t({session:c(r.context),mfa:null,error:null}):r.matches({authentication:{si
message.txt
5 KB
Screenshot from Vercel deployment:
