I am further continuing to explore deploying a gatsby project to appengine

I created an appengine service called 'gatsby', and I want to serve in the
following manner
https://bgsample.appspot.com/gatsby
<https://mailtrack.io/trace/link/dd7d91af6834badffa0a8a87feef4f219ec51f45?url=https%3A%2F%2Fbgsample.appspot.com%2Fgatsby&userId=6615365&signature=6fa16981fc83af6d>

app.yaml: gatsby-standard folder in the github:
https://github.com/rajesh99/bgsample
<https://mailtrack.io/trace/link/650a3ecacb84ef69c43564883351e3fbb28cc7e3?url=https%3A%2F%2Fgithub.com%2Frajesh99%2Fbgsample&userId=6615365&signature=1a0ecb1bf559761c>

runtime: nodejs14
service: gatsby

handlers:
- url: /gatbsy
  static_files: public/index.html
  upload: public/index.html
- url: /gatsby/
  static_files: public/index.html
  upload: public/index.html
- url: /gatsby/(.*)
  static_files: public/\1
  upload: public/(.*)


The main project: default-standard folder in the github:
https://github.com/rajesh99/bgsample
<https://mailtrack.io/trace/link/db34686008f2059e9bf200d9814baad8d0f4e9be?url=https%3A%2F%2Fgithub.com%2Frajesh99%2Fbgsample&userId=6615365&signature=5c6657298e9d2d08>
dispatch.yaml
dispatch:
  # Send all listing traffic to the listing frontend.
- url: "*/prolisting/*"
  service: prolisting
- url: "*/prolisting"
  service: prolisting
- url: "*/gatsby/*"
  service: gatsby
- url: "*/gatsby"
  service: gatsby


There are two issues
1st issue:
https://bgsample.appspot.com/gatsby/
<https://mailtrack.io/trace/link/a5b487a3222dc922310a638070a6bcd3fbe46544?url=https%3A%2F%2Fbgsample.appspot.com%2Fgatsby%2F&userId=6615365&signature=d094100e3a221c29>
- this works
https://bgsample.appspot.com/gatsby
<https://mailtrack.io/trace/link/10b47b7b1f02681de60c44dfa6b530f627309f71?url=https%3A%2F%2Fbgsample.appspot.com%2Fgatsby&userId=6615365&signature=42853a4619eb155d>
- this does not work - why?

2nd issue:
https://bgsample.appspot.com/gatsby/
<https://mailtrack.io/trace/link/ab9e3a2703e454f69635dd391c9b22d857aa32d8?url=https%3A%2F%2Fbgsample.appspot.com%2Fgatsby%2F&userId=6615365&signature=4e4ecd4330f21bf2>
- Then click on 'A' link it works.
Now you do refresh, it does not work.  Following displays on the browser
"Error: Not Found
The requested URL /gatsby/a/ was not found on this server."

I used the following reference to serve gatsby static files
https://github.com/gatsbyjs/gatsby/issues/22711
<https://mailtrack.io/trace/link/0040ef4ffef364b6673507745166048c64fbd417?url=https%3A%2F%2Fgithub.com%2Fgatsbyjs%2Fgatsby%2Fissues%2F22711&userId=6615365&signature=10685a1f073ebb26>

I have to say, I did not understand some parts of the app.yaml file.

Appreciate any help.

Cheers.

On Tue, Mar 15, 2022 at 4:11 PM Rajesh G <rajesh.gu...@veersoftsolutions.com>
wrote:

> Ok.  It works now.  Thanks
>
> On Mon, Mar 14, 2022 at 9:35 PM 'Jofre Riba Sánchez' via Google App Engine
> <google-appengine@googlegroups.com> wrote:
>
>> Your app.js in the prolisting folder of the example repo does not have a
>> handler for the /prolisting path. This is why express can't get the
>> /prolisting [1].
>>
>> Fix this by adding an additional handler for the path in app.js:
>>
>> app.get('/prolisting', (req, res) => {
>> res.status(200).send('Hello, world prolisting!').end();
>> });
>>
>> Note that when you dispatch with a path (i.e. /prolisting), the path is
>> kept when calling the dispatched service. The dispatch rules do not remove
>> the path.
>>
>> [1] https://expressjs.com/en/guide/routing.html
>> On Saturday, March 12, 2022 at 7:43:46 AM UTC+1
>> rajesh...@veersoftsolutions.com wrote:
>>
>>> Hi,
>>> I created two simple services based on nodejs and hello-world sample.
>>>
>>> I am trying to explore dispatch.yaml
>>> My dispatch.yaml.
>>> dispatch:
>>>   # Send all listing traffic to the listing frontend.
>>> - url: "*/prolisting/*"
>>>   service: prolisting
>>> - url: "*/prolisting"
>>>   service: prolisting
>>> - url: "*/*"
>>>   service: default
>>>
>>>
>>> 'prolisting' service app.yaml
>>> runtime: nodejs14
>>> service: prolisting
>>>
>>> default service app.yaml
>>> runtime: nodejs14
>>>
>>> I have uploaded to bgsample.appspot.com.
>>> The default works: bgsample.appspot.com
>>> The prolisting also works:
>>> https://prolisting-dot-bgsample.uc.r.appspot.com
>>>
>>> However, the following URL does not work
>>> https://bgsample.appspot.com/prolisting
>>>
>>> As per the dispatch.yaml, it should route to prolisting service, but
>>> gives the following error
>>> Cannot GET /prolisting
>>>
>>> my repo:
>>> https://github.com/rajesh99/bgsample
>>>
>>> Cheers,
>>>
>>> --
>>> Support Team
>>> www.servicefolder.com
>>> *Field Service Software on Google Cloud Platform and Mobile*
>>>
>>>
>>> --
>> You received this message because you are subscribed to the Google Groups
>> "Google App Engine" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to google-appengine+unsubscr...@googlegroups.com.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/google-appengine/d77d5b82-4bcb-43ac-821f-91454007a310n%40googlegroups.com
>> <https://groups.google.com/d/msgid/google-appengine/d77d5b82-4bcb-43ac-821f-91454007a310n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
>
>
> --
> Support Team
> www.servicefolder.com
> *Field Service Software on Google Cloud Platform and Mobile*
>
>
>

-- 
Support Team
www.servicefolder.com
*Field Service Software on Google Cloud Platform and Mobile*

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to google-appengine+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/google-appengine/CA%2BS7ijaH2YANoNq0jyojseM4Q5CTjXMqUHCZhYVn1swbobqz-A%40mail.gmail.com.

Reply via email to