enuchi / React-Google-Apps-Script

This is your boilerplate project for developing React apps inside Google Sheets, Docs, Forms and Slides projects. It's perfect for personal projects and for publishing complex add-ons in the Google Workspace Marketplace.
MIT License
1.34k stars 178 forks source link

google.script not found in development mode #163

Open Raj00377 opened 1 year ago

Raj00377 commented 1 year ago

I have configured using it gas-client package

const { serverFunctions } = new GASClient<typeof publicServerFunctions>({
  // this is necessary for local development but will be ignored in production
  allowedDevelopmentDomains: (origin) => 
    (/https:\/\/.*\.googleusercontent\.com$/.test(origin) || origin === 'https:localhost:3000') ? true : false
  }
})

Anyone has faced this issue? @enuchi

enuchi commented 1 year ago

Should not add your localhost address there. Can you share what exact error you're seeing, and also include what platform (OS)/browser/node versions you're using?

Raj00377 commented 1 year ago

While using npm run start, I'm getting origin as localhost:3000 that's why i'hve put there. OS : Ubuntu 20.04.5 LTS 64-bit node version : v16.18.1

Screenshot from 2022-12-26 15-14-27

enuchi commented 1 year ago

I need to update the Readme. You only need to have the Google domain that loads the iframe there. I see you've moved some files around. Does your issue happen with a fresh install of this project?

Raj00377 commented 1 year ago

Yes. i've add another entry point in webpack, but the server functions are imported from the /client/utils only. i've been playing with this project for past 1 month. i'll try to do a fresh install.

enuchi commented 1 year ago

Yes, do a clean install. You shouldn't need to change (/https:\/\/.*\.googleusercontent\.com$/.test(origin) -- if the domain is wrong the app would still load, it just wouldn't be able to make server calls.