Skip to content

how to set NEXT_PUBLIC_SALEOR_API_URL #1077

@liwenz

Description

@liwenz

Summary

I start saleor core with python manage.py runserver,then start storefront with NEXT_PUBLIC_SALEOR_API_URL=http://localhost:8000/graphql/
also https://localhost:8000/graphql/, http://localhost:8000/
but it can't connect.
if NEXT_PUBLIC_SALEOR_API_URL=https://storefront1.saleor.cloud/graphql/
the storefront works well.

Steps to reproduce

(saleor) leon@leon-MacBookPro:~/saleor$ python manage.py runserver
{"asctime": "2024-03-09T23:31:05Z", "levelname": "INFO", "lineno": 637, "message": "Watching for file changes with StatReloader", "name": "django.utils.autoreload", "pathname": "/home/leon/.pyenv/versions/saleor/lib/python3.9/site-packages/django/utils/autoreload.py", "process": 5176, "threadName": "MainThread", "hostname": "leon-MacBookPro"}
Performing system checks...

System check identified no issues (0 silenced).
March 09, 2024 - 23:31:14
Django version 3.2.25, using settings 'saleor.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
{"asctime": "2024-03-09T23:43:26Z", "levelname": "INFO", "lineno": 161, "message": "code 400, message Bad request version ("\x01\u00c8\x00v\x13\x02\x13\x03\x13\x01\u00c0/\u00c0+\u00c00\u00c0,\x00\x9e\u00c0'\x00g\u00c0(\x00k\x00\u00a3\x00\x9f\u00cc\u00a9\u00cc\u00a8\u00cc\u00aa\u00c0\u00af\u00c0\xad\u00c0\u00a3\u00c0\x9f\u00c0]\u00c0a\u00c0W\u00c0S\x00\u00a2\u00c0\u00ae\u00c0\u00ac\u00c0\u00a2\u00c0\x9e\u00c0\\\u00c0`\u00c0V\u00c0R\u00c0$\x00j\u00c0#\x00@\u00c0")", "name": "django.server", "pathname": "/home/leon/.pyenv/versions/saleor/lib/python3.9/site-packages/django/core/servers/basehttp.py", "process": 5176, "threadName": "Thread-1", "request": "<socket.socket fd=6, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 8000), raddr=('127.0.0.1', 47680)>", "server_time": "09/Mar/2024 23:43:26", "hostname": "leon-MacBookPro"}
{"asctime": "2024-03-09T23:43:26Z", "levelname": "ERROR", "lineno": 142, "message": "You're accessing the development server over HTTPS, but it only supports HTTP.\n", "name": "django.server", "pathname": "/home/leon/.pyenv/versions/saleor/lib/python3.9/site-packages/django/core/servers/basehttp.py", "process": 5176, "threadName": "Thread-1", "request": "<socket.socket fd=6, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 8000), raddr=('127.0.0.1', 47680)>", "server_time": "09/Mar/2024 23:43:26", "status_code": 500, "hostname": "leon-MacBookPro"}
{"asctime": "2024-03-09T23:44:49Z", "levelname": "INFO", "lineno": 161, "message": ""POST /graphql/ HTTP/1.1" 301 0", "name": "django.server", "pathname": "/home/leon/.pyenv/versions/saleor/lib/python3.9/site-packages/django/core/servers/basehttp.py", "process": 5176, "threadName": "Thread-2", "request": "<socket.socket fd=6, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=0, laddr=('127.0.0.1', 8000), raddr=('127.0.0.1', 43354)>", "server_time": "09/Mar/2024 23:44:49", "status_code": 301, "hostname": "leon-MacBookPro"}


[email protected] generate /home/leon/storefront

graphql-codegen --config .graphqlrc.ts

✔ Parse Configuration
⚠ Generate outputs
❯ Generate to src/gql/

Failed to load schema from http://localhost:8000/graphql/:
write EPROTO 00E8CC729A7F0000:error:0A00010B:SSL routines:ssl3_get_reco…
Error: write EPROTO 00E8CC729A7F0000:error:0A00010B:SSL routines:ssl3_g…
at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base…
GraphQL Code Generator supports:
- ES Modules and CommonJS exports (export as default or named export "s…
- Introspection JSON File
- URL of GraphQL endpoint
- Multiple files with type definitions (glob expression)
- String in config file
Try to use one of above options and run codegen again.
◼ Load GraphQL documents
◼ Generate
 ELIFECYCLE  Command failed with exit code 1.


(saleor) leon@leon-MacBookPro:~/storefront$ npm run dev

[email protected] predev
pnpm run generate

[email protected] generate /home/leon/storefront
graphql-codegen --config .graphqlrc.ts

✔ Parse Configuration
⚠ Generate outputs
❯ Generate to src/gql/

Failed to load schema from http://localhost:8000:
write EPROTO 0088C8B4877F0000:error:0A00010B:SSL routines:ssl3_get_reco…
Error: write EPROTO 0088C8B4877F0000:error:0A00010B:SSL routines:ssl3_g…
at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base…
GraphQL Code Generator supports:
- ES Modules and CommonJS exports (export as default or named export "s…
- Introspection JSON File
- URL of GraphQL endpoint
- Multiple files with type definitions (glob expression)
- String in config file
Try to use one of above options and run codegen again.
◼ Load GraphQL documents
◼ Generate
 ELIFECYCLE  Command failed with exit code 1.

A link to a reproduction repository

No response

Output from envinfo

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions